Interview Q&A

Technical interview Q&A plus 100+ career & HR questions—notice period, salary negotiation, resume, LinkedIn, freelancing, AI careers, and behavioral interviews with detailed, real-world answers.

Career & HR topics

By tech stack (from PDF library)

Popular tracks

ADO.NET ADO.NET Core Tutorial · ADO.NET

executable code.

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

DO.NET (Active Data Objects .NET) is a data access technology in the .NET framework

that enables applications to interact with databases and other data sources. It provides a set

of classes for connecting to databases, retrieving data, manipulating data, and updating

data. ADO.NET is designed for disconnected data access, meaning that data can be

retrieved, modified, and worked with without maintaining an ongoing connection to the

database.

Real-Time Example:

In a C# application, ADO.NET is used to retrieve a list of products from a database and

display it in a UI like a GridView. The data is fetched from the database, stored in a DataSet

or DataTable, and then bound to the UI controls.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

DataReader).

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Answer: memory-efficient and fast for large result sets. It reads data row-by-row instead of loading everything into memory at once, like a DataSet.

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

  • By sharing common intrinsic states (like the symbol in this case), the

Flyweight Pattern reduces memory consumption significantly. Instead of

creating multiple objects for each appearance of a character, only one object

is created for each unique character.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

hasn't been committed yet. Fast but can result in inconsistencies.

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

  • Optimistic Concurrency assumes that conflicts will be rare and allows multiple

users to read and modify data without locking it.

  • When updating data, you compare the current data in the database with the data the

user fetched earlier (usually by checking a timestamp or version number). If the data

has been changed by someone else, you throw a concurrency exception.

Steps:

  • Add a timestamp or row version column to the table.
  • When updating, check if the timestamp or row version has changed.

Example:

SqlCommand command = new SqlCommand("UPDATE Customers SET

CustomerName = @CustomerName WHERE CustomerID = @CustomerID AND

RowVersion = @RowVersion", connection);

command.Parameters.AddWithValue("@CustomerName", customerName);

command.Parameters.AddWithValue("@CustomerID", customerId);

command.Parameters.AddWithValue("@RowVersion", rowVersion);

If the RowVersion has changed between the time the user fetched the data and the time

they attempt to update, the update will fail, and an exception will be thrown.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Answer: command or stored procedure. Example: SqlCommand command = new SqlCommand("SELECT * FROM Customers", connection);

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

empty, check for valid formats, or check for duplicate records).

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

DataTable.

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

CommandType.StoredProcedure.

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

SqlCommand command = new SqlCommand("SELECT CustomerName,

ContactName FROM Customers WHERE CustomerID = @CustomerID",

connection);

command.Parameters.AddWithValue("@CustomerID", 1);

connection.Open();

SqlDataReader reader = command.ExecuteReader();
if (reader.Read()) // Checks if there's data
{
string customerName = reader["CustomerName"].ToString();
string contactName = reader["ContactName"].ToString();

Console.WriteLine($"Customer: {customerName}, Contact:

{contactName}");

}

reader.Close();

connection.Close();

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

pages) using SQL's LIMIT, OFFSET, or TOP clauses. You can implement paging on

both the server side (in the SQL query) and the client side (in the ASP.NET

application).

Example (Using Paging in SQL):

string query = "SELECT * FROM Customers ORDER BY CustomerID OFFSET

@Offset ROWS FETCH NEXT @PageSize ROWS ONLY";

SqlCommand command = new SqlCommand(query, connection);

command.Parameters.AddWithValue("@Offset", pageNumber * pageSize);

command.Parameters.AddWithValue("@PageSize", pageSize);

connection.Open();

SqlDataReader reader = command.ExecuteReader();

while (reader.Read())

// Process data

Follow:

reader.Close();

connection.Close();

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

case, a CustomerID). Practical/Scenario-Based ADO.NET Questions

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Answer: Example of preventing SQL injection: SqlCommand command = new SqlCommand("SELECT * FROM Customers WHERE CustomerName = @CustomerName", connection); command.Parameters.AddWithValue("@CustomerName", customerName); // Use parameterized query

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Answer: UpdateCommand, and DeleteCommand properties of the DataAdapter to define how data changes should be applied to the database.

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Answer: ccess, Oracle). Example: OleDbCommand command = new OleDbCommand("SELECT * FROM Customers", connection);

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Answer: Pessimistic Concurrency locks the data when it is being read or modified to ensure that no other transaction can access it until the current operation is complete. This is usually done with SQL transactions and locking hints.

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Example:

protected void Page_Load(object sender, EventArgs e)

if (!IsPostBack)

SqlConnection connection = new

SqlConnection(connectionString);

SqlDataAdapter adapter = new SqlDataAdapter("SELECT

CustomerID, CustomerName FROM Customers", connection);

DataTable dataTable = new DataTable();

Follow:

adapter.Fill(dataTable);

GridView1.DataSource = dataTable;

GridView1.DataBind();

Here, GridView1 is bound to the data returned from the SQL query (SELECT

CustomerID, CustomerName FROM Customers), and the DataBind() method

displays it in the grid.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

The main components of ADO.NET are:

  • Connection: Represents the connection to a data source (e.g., SQL Server, Oracle).
  • Example: SqlConnection, OleDbConnection, OracleConnection.
  • Command: Represents a SQL query or stored procedure to be executed against the

data source.

  • Example: SqlCommand, OleDbCommand.
  • DataReader: Provides a forward-only, read-only cursor for retrieving data from the

database.

  • Example: SqlDataReader.
  • DataSet: Represents an in-memory cache of data, which can hold multiple

DataTables and relationships.

  • Example: DataSet.
  • DataAdapter: Acts as a bridge between a DataSet and a data source. It fills a

DataSet or updates a data source.

  • Example: SqlDataAdapter.
Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

dapter.Fill(dataTable);

GridView1.DataSource = dataTable;

GridView1.DataBind();

}
}

Here, GridView1 is bound to the data returned from the SQL query (SELECT

CustomerID, CustomerName FROM Customers), and the DataBind() method

displays it in the grid.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

  • DataReader is faster than DataSet because it retrieves data in a streaming

manner, one row at a time, without creating copies of the data.

  • DataSet requires more processing to maintain its structure (tables,

relationships) and populate in memory.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

pplication).

Example (Using Paging in SQL):

string query = "SELECT * FROM Customers ORDER BY CustomerID OFFSET

@Offset ROWS FETCH NEXT @PageSize ROWS ONLY";

SqlCommand command = new SqlCommand(query, connection);

command.Parameters.AddWithValue("@Offset", pageNumber * pageSize);

command.Parameters.AddWithValue("@PageSize", pageSize);

connection.Open();

SqlDataReader reader = command.ExecuteReader();

while (reader.Read())

{

// Process data

}

reader.Close();

connection.Close();

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Answer: dapter.Fill(dataset, "Customers"); // Modify data in the DataSet dataset.Tables["Customers"].Rows[0]["CustomerName"] = "New Name"; // Update the database with the modified data dapter.Update(dataset, "Customers");

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

the data in a DataReader.

Example:

string query = "SELECT Customers.CustomerID, Customers.CustomerName,

Orders.OrderID, Orders.OrderDate " +

"FROM Customers " +

"INNER JOIN Orders ON Customers.CustomerID =

Orders.CustomerID";

SqlCommand command = new SqlCommand(query, connection);

connection.Open();

SqlDataReader reader = command.ExecuteReader();

while (reader.Read())

Follow:

Console.WriteLine("Customer: " + reader["CustomerName"] + ",

Order ID: " + reader["OrderID"]);

reader.Close();

connection.Close();

Alternatively, you can use a DataSet to load data from multiple tables, which will maintain

the relationships between the tables.

Example (Using DataSet):

string query = "SELECT * FROM Customers; SELECT * FROM Orders";

SqlDataAdapter adapter = new SqlDataAdapter(query, connection);

DataSet dataSet = new DataSet();

adapter.Fill(dataSet);

Here, dataSet.Tables[0] will contain Customers, and dataSet.Tables[1] will

contain Orders.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

  • ADO (ActiveX Data Objects): ADO is a COM-based technology that works with

databases in a connected environment (requiring an open connection to the

database for the duration of data retrieval).

  • ADO.NET: ADO.NET, in contrast, focuses on disconnected data access. It allows

you to retrieve data, work on it offline (disconnected), and then send any changes

back to the database.

Key Differences:

  • ADO relies on active connections to the database, whereas ADO.NET uses a

disconnected model (DataSet, DataTable).

  • ADO.NET provides better support for XML, scalability, and performance in multi-tier

applications.

Follow:

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Answer: database operations asynchronously to avoid blocking the main thread and keep the application responsive.

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Answer: Example: using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); // Execute commands here connection.Close(); }

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Answer: Example: SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM Customers", connection); DataTable dt = new DataTable(); Follow: adapter.Fill(dt); GridView1.DataSource = dt; GridView1.DataBind();

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Example:

SqlConnection connection = new SqlConnection(connectionString);

connection.Open();

SqlTransaction transaction = connection.BeginTransaction();

try

{

SqlCommand command1 = new SqlCommand("UPDATE Customers SET

Balance = Balance - 100", connection, transaction);

SqlCommand command2 = new SqlCommand("UPDATE Accounts SET

Balance = Balance + 100", connection, transaction);

command1.ExecuteNonQuery();

command2.ExecuteNonQuery();

transaction.Commit(); // Commit the transaction

}

catch (Exception)

{

transaction.Rollback(); // Rollback if there is an error

}

finally

{

connection.Close();

}
Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Example:

SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM

Customers", connection);

SqlCommandBuilder commandBuilder = new SqlCommandBuilder(adapter);

// Automatically generates insert, update, delete commands

Follow:

DataSet dataset = new DataSet();

adapter.Fill(dataset, "Customers");

// Modify data in the DataSet

dataset.Tables["Customers"].Rows[0]["CustomerName"] = "New Name";

// Update the database with the modified data

adapter.Update(dataset, "Customers");

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Example:

// Assuming you already have a populated DataTable

DataTable table = new DataTable();

Follow:

SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM

Customers", connection);

// Set commands for Insert, Update, and Delete

adapter.UpdateCommand = new SqlCommand("UPDATE Customers SET

CustomerName = @CustomerName WHERE CustomerID = @CustomerID",

connection);

adapter.UpdateCommand.Parameters.Add("@CustomerName",

SqlDbType.NVarChar, 100, "CustomerName");

adapter.UpdateCommand.Parameters.Add("@CustomerID", SqlDbType.Int,

4, "CustomerID");

// Update the database

adapter.Update(table);

After modifying the DataTable, the Update method pushes those changes to the database.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

dapter.Fill(dt); GridView1.DataSource = dt; GridView1.DataBind();

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Answer: dapter.Fill(dataset, "Customers"); // Populates the DataSet with data from the "Customers" table

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

dapter.UpdateCommand = new SqlCommand("UPDATE Customers SET

CustomerName = @CustomerName WHERE CustomerID = @CustomerID",

connection);

dapter.UpdateCommand.Parameters.Add("@CustomerName",

SqlDbType.NVarChar, 100, "CustomerName");

dapter.UpdateCommand.Parameters.Add("@CustomerID", SqlDbType.Int,

4, "CustomerID");

// Update the database

dapter.Update(table);

fter modifying the DataTable, the Update method pushes those changes to the database.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Answer: Example: SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM Customers", connection); DataSet dataset = new DataSet(); adapter.Fill(dataset, "Customers"); // Populates the DataSet with data from the "Customers" table

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

dates).

Example:

string customerName = txtCustomerName.Text;
if (string.IsNullOrWhiteSpace(customerName))
{

throw new ArgumentException("Customer name cannot be empty");

}

SqlCommand command = new SqlCommand("INSERT INTO Customers

(CustomerName) VALUES (@CustomerName)", connection);

command.Parameters.AddWithValue("@CustomerName", customerName);

connection.Open();

command.ExecuteNonQuery();

connection.Close();

This ensures that the CustomerName is not empty before inserting it into the database.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

ExecuteScalar() depending on the type of result.

Example:

SqlCommand command = new SqlCommand("GetCustomerDetails",

connection);

command.CommandType = CommandType.StoredProcedure;

command.Parameters.AddWithValue("@CustomerID", customerId);

SqlDataReader reader = command.ExecuteReader();
Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

possible.

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Answer: Connectivity) drivers. Example: OdbcCommand command = new OdbcCommand("SELECT * FROM Customers", connection);

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

  • DataReader is ideal when you only need to read the data sequentially and

don’t need to modify the data or navigate backward.

  • DataSet is better when you need to work with disconnected data, modify it

offline, and later update the database.

Example (using DataReader for better performance):

SqlCommand command = new SqlCommand("SELECT * FROM Customers",

connection);

connection.Open();

SqlDataReader reader = command.ExecuteReader();

while (reader.Read())

{

Console.WriteLine(reader["CustomerName"].ToString());

}

reader.Close();

When to Use:

  • Use DataReader for large result sets where you need fast, sequential data access

without requiring complex data manipulation.

  • Use DataSet when you need to work with a disconnected data model or need to

modify data offline.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Answer: restrictive but guarantees the highest level of consistency. You set the isolation level using the Transaction object: SqlTransaction transaction = connection.BeginTransaction(IsolationLevel.Serializable);

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Answer: Example: OracleCommand command = new OracleCommand("SELECT * FROM Customers", connection);

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

  • DataSet: A collection of DataTables and relationships that represent the data in a

disconnected mode. A DataSet can hold multiple DataTables, each corresponding to

a database table or view. It's also capable of handling data relationships, such as

parent-child relationships.

  • Example: A DataSet might hold a DataTable for customers and another for

their orders.

  • DataTable: A single table of in-memory data, which is part of a DataSet. It represents

one database table and allows you to work with the data offline.

  • Example: A DataTable for the Customers table that contains rows

representing each customer.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

database table or view. It's also capable of handling data relationships, such as

parent-child relationships.

  • Example: A DataSet might hold a DataTable for customers and another for

their orders.

  • DataTable: A single table of in-memory data, which is part of a DataSet. It represents

one database table and allows you to work with the data offline.

  • Example: A DataTable for the Customers table that contains rows

representing each customer.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

  • DataSet: It is a disconnected, in-memory data structure that can hold multiple tables.

It can also be updated and later written back to the database. You can move back

and forth between rows (using DataRow and DataColumn).

  • DataReader: A DataReader is a forward-only, read-only data cursor. It provides

faster, streaming access to the data from the database but doesn’t allow

modifications. It maintains an open connection while reading data.

Example:

  • DataSet: If you're working on a report with multiple tables, such as Customers,

Orders, and Products, you'd use a DataSet.

  • DataReader: If you're fetching customer details one by one for a quick operation, a

DataReader would be used.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

nd forth between rows (using DataRow and DataColumn).

  • DataReader: A DataReader is a forward-only, read-only data cursor. It provides

faster, streaming access to the data from the database but doesn’t allow

modifications. It maintains an open connection while reading data.

Example:

  • DataSet: If you're working on a report with multiple tables, such as Customers,

Orders, and Products, you'd use a DataSet.

  • DataReader: If you're fetching customer details one by one for a quick operation, a

DataReader would be used.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

DataAdapter serves as a bridge between a DataSet/DataTable and the database. It is

used to fill a DataSet with data and to update changes made in the DataSet back to the

database.

Example:

SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM

Customers", connection);

DataSet dataset = new DataSet();

dapter.Fill(dataset, "Customers"); // Fills DataSet with data from

the Customers table

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

The Connection object represents a connection to a specific data source (e.g., SQL

Server). It is used to establish and manage the connection to the database, execute queries,

and close the connection when done.

Example:

SqlConnection connection = new SqlConnection(connectionString);

connection.Open();

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Answer: nd close the connection when done. Example: SqlConnection connection = new SqlConnection(connectionString); connection.Open();

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

The Command object is used to execute SQL queries or stored procedures against a

database. It encapsulates the SQL statement or stored procedure and returns results.

Example:

SqlCommand command = new SqlCommand("SELECT * FROM Customers",

connection);

SqlDataReader reader = command.ExecuteReader();
Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Follow:

  • ExecuteNonQuery: Executes SQL commands that do not return data (e.g., INSERT,

UPDATE, DELETE).

  • Example: command.ExecuteNonQuery(); (used to insert a record).
  • ExecuteReader: Executes SQL commands that return rows (e.g., SELECT queries).

It returns a DataReader.

  • Example: command.ExecuteReader(); (used to select records).
  • ExecuteScalar: Executes SQL commands and returns a single value (e.g., a single

cell of data).

  • Example: command.ExecuteScalar(); (used for retrieving the count or

aggregate values).

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

The ConnectionString contains information required to connect to the database, such as

the database server, database name, credentials, and other configurations.

Example:

string connectionString = "Data Source=server_name;Initial
Catalog=database_name;User ID=user_name;Password=password;";
Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

  • SqlConnection: Used specifically for connecting to SQL Server databases.
  • OleDbConnection: A more general connection class that can connect to a variety of

data sources, such as MS Access, Excel, Oracle, etc.

Example:

Use SqlConnection for SQL Server:

SqlConnection sqlConnection = new SqlConnection(connectionString);
  • Use OleDbConnection for Access or other databases:

OleDbConnection oleDbConnection = new

OleDbConnection(connectionString);

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

  • SQLCommand: A SQL command is a string of SQL code (like SELECT, INSERT,

etc.) that is executed directly against the database.

  • Stored Procedure: A precompiled collection of SQL statements that can be

executed as a unit. It can contain more complex logic, including control-of-flow and

error handling.

Example:

  • SQL Command: SELECT * FROM Customers;
  • Stored Procedure: EXEC GetCustomerDetails;
Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Connection Pooling allows multiple applications or threads to reuse existing database

connections instead of opening a new connection each time. It improves performance by

reducing the overhead of opening and closing connections repeatedly.

Example: When using SQL Server, the connection pool automatically manages the reuse of

connections.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

  • Disconnected model: ADO.NET uses a disconnected model (DataSet/DataTable),

which allows applications to work offline, reducing the load on the database.

  • Better performance: ADO.NET allows better resource management and can handle

large data volumes efficiently.

  • XML support: ADO.NET has built-in support for XML, making it easier to work with

XML data.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

examples.

  • DataSet: Works in a disconnected mode and holds multiple tables and relationships.

You can navigate and manipulate the data offline.

  • Example: Use a DataSet to hold customer and order data for offline

processing.

  • DataReader: A forward-only, read-only cursor that requires an open connection to

the database. It is faster for reading large amounts of data in a streaming manner.

  • Example: Use DataReader when fetching records to display in a report or grid

in a single-pass, forward-only manner.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

The CommandTimeout property specifies the amount of time (in seconds) before a

command is considered to have timed out. If the command execution takes longer than the

specified time, an error is raised.

Example:

SqlCommand command = new SqlCommand("SELECT * FROM Customers",

connection);

command.CommandTimeout = 30; // Timeout after 30 seconds
Intermediate ADO.NET Questions
Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Answer: The SqlDataAdapter serves as a bridge between a DataSet (or DataTable) and the database. It is responsible for:

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

To update the database using a DataSet:

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

mount of data quickly and do not need to modify the data. It requires an open connection to

the database and reads data sequentially, one row at a time.

Example:

SqlCommand command = new SqlCommand("SELECT CustomerName FROM

Customers", connection);

SqlDataReader reader = command.ExecuteReader();

while (reader.Read())

{

Console.WriteLine(reader["CustomerName"]);

}

reader.Close();

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

The SqlDataReader is used to retrieve data from the database in a forward-only and

read-only manner. It is more efficient than a DataSet when you need to retrieve a large

amount of data quickly and do not need to modify the data. It requires an open connection to

the database and reads data sequentially, one row at a time.

Example:

SqlCommand command = new SqlCommand("SELECT CustomerName FROM

Customers", connection);

SqlDataReader reader = command.ExecuteReader();

while (reader.Read())

Console.WriteLine(reader["CustomerName"]);

reader.Close();

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Answer: dapter.Fill(dataset, "Customers"); // Fills the DataSet with data from the "Customers" table

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

The Fill() method of the DataAdapter is used to populate a DataSet or DataTable with data

from the database. It executes the SELECT query defined in the DataAdapter and fills the

specified DataSet or DataTable with the results.

Example:

SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM

Customers", connection);

DataSet dataset = new DataSet();

Follow:

adapter.Fill(dataset, "Customers"); // Fills the DataSet with data

from the "Customers" table

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Answer: In ADO.NET, database connections are managed using the Connection object, such as SqlConnection for SQL Server. The process involves:

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

To execute a stored procedure using ADO.NET:

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

  • DataSet is a collection of DataTable objects, and it can hold multiple tables and

relationships between them. It is used for handling disconnected data and can work

offline, and it can also support complex structures, such as parent-child relationships.

  • DataTable represents a single table in-memory and contains rows and columns. It

can be used for simpler scenarios where only one table of data is needed.

Example:

  • DataSet: Holds multiple tables, such as Customers and Orders.
  • DataTable: Holds data from a single table like Customers.
Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

To bind a DataTable to a GridView in ASP.NET:

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

DO.NET exceptions are typically handled using try-catch blocks. This helps to capture any

errors during database operations such as connection failures, query issues, or command

execution errors.

Example:

try

{
SqlConnection connection = new SqlConnection(connectionString);

connection.Open();

SqlCommand command = new SqlCommand("SELECT * FROM Customers",

connection);

SqlDataReader reader = command.ExecuteReader();
}

catch (SqlException ex)

{

Console.WriteLine("Database error: " + ex.Message);

}

catch (Exception ex)

{

Console.WriteLine("General error: " + ex.Message);

}
Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

The SqlConnection object is responsible for opening a connection to a SQL Server

database. It represents the physical connection to the data source and must be open before

executing commands (like SqlCommand) or reading data (using SqlDataReader or

SqlDataAdapter).

Example:

SqlConnection connection = new SqlConnection(connectionString);

connection.Open();

// Execute database commands

connection.Close();

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

  • Strongly Typed DataSet: A DataSet that is generated from an XSD (XML Schema

Definition) file, which defines the structure of the data (tables, columns,

relationships). It provides type safety and compile-time checking.

  • Loosely Typed DataSet: A DataSet that does not have predefined schemas,

meaning you access tables and columns by name at runtime. This offers flexibility but

no compile-time checking.

Example:

  • Strongly Typed: You get intellisense and type safety when accessing columns.
  • Loosely Typed: You need to access tables and columns by name as strings, without
intellisense.
Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Answer: transaction in ADO.NET is a sequence of database operations that are executed as a single unit. If one operation fails, all previous operations are rolled back. You can manage transactions using the SqlTransaction object. Steps:

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

You can execute multiple transactions sequentially by managing multiple SqlTransaction

objects. Each transaction can either be committed or rolled back based on the success or

failure of the operations.

Example:

SqlConnection connection = new SqlConnection(connectionString);

connection.Open();

SqlTransaction transaction1 = connection.BeginTransaction();

SqlTransaction transaction2 = connection.BeginTransaction();

Follow:

try

// First transaction

SqlCommand command1 = new SqlCommand("UPDATE Customers SET

Balance = Balance - 100", connection, transaction1);

command1.ExecuteNonQuery();

transaction1.Commit();

Advanced ADO.NET Questions

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Answer: In ADO.NET, the Command object is used to execute SQL queries or stored procedures. The main types of Command objects are:

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

ADO.NET supports asynchronous database operations using the async and await

keywords in C#. This allows the application to remain responsive while waiting for the

database operation to complete.

  • ExecuteNonQueryAsync: Executes a SQL command asynchronously.
  • ExecuteReaderAsync: Executes a query and returns a SqlDataReader

asynchronously.

  • ExecuteScalarAsync: Executes a query and returns a single value asynchronously.

Example:

public async Task GetDataAsync()

SqlConnection connection = new SqlConnection(connectionString);

await connection.OpenAsync();

SqlCommand command = new SqlCommand("SELECT * FROM Customers",

connection);

SqlDataReader reader = await command.ExecuteReaderAsync();

while (await reader.ReadAsync())

Console.WriteLine(reader["CustomerName"].ToString());

reader.Close();

Follow:

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

DO.NET?

DO.NET supports asynchronous database operations using the async and await

keywords in C#. This allows the application to remain responsive while waiting for the

database operation to complete.

  • ExecuteNonQueryAsync: Executes a SQL command asynchronously.
  • ExecuteReaderAsync: Executes a query and returns a SqlDataReader

synchronously.

  • ExecuteScalarAsync: Executes a query and returns a single value asynchronously.

Example:

public async Task GetDataAsync()
{
SqlConnection connection = new SqlConnection(connectionString);

wait connection.OpenAsync();

SqlCommand command = new SqlCommand("SELECT * FROM Customers",

connection);

SqlDataReader reader = await command.ExecuteReaderAsync();

while (await reader.ReadAsync())

{

Console.WriteLine(reader["CustomerName"].ToString());

}

reader.Close();

}
Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

DO.NET.

stored procedure is a precompiled set of SQL statements that are stored and executed

on the database server. They can improve performance and security by encapsulating

complex operations.

In ADO.NET, stored procedures are executed using the SqlCommand object, where the

CommandType property is set to CommandType.StoredProcedure.

Example:

SqlCommand command = new SqlCommand("GetCustomerDetails",

connection);

command.CommandType = CommandType.StoredProcedure;

command.Parameters.AddWithValue("@CustomerID", customerId);

SqlDataReader reader = command.ExecuteReader();
Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Parameters are used to pass values to SQL commands or stored procedures. They provide

a way to safely and securely inject data into queries, reducing the risk of SQL injection

attacks.

In ADO.NET, you handle parameters using the Parameters collection of a SqlCommand

object.

Example:

SqlCommand command = new SqlCommand("SELECT * FROM Customers WHERE

CustomerID = @CustomerID", connection);

command.Parameters.AddWithValue("@CustomerID", customerId);

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

way to safely and securely inject data into queries, reducing the risk of SQL injection

ttacks.

In ADO.NET, you handle parameters using the Parameters collection of a SqlCommand

object.

Example:

SqlCommand command = new SqlCommand("SELECT * FROM Customers WHERE

CustomerID = @CustomerID", connection);

command.Parameters.AddWithValue("@CustomerID", customerId);

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

SQL injection attacks can be prevented by:

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Answer: snapshot of the data and remains unchanged even if the data in the database changes during the operation. It is slower and consumes more memory compared to forward-only cursor.

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

  • Forward-only cursor: A cursor that allows you to read rows sequentially in a forward

direction only. It is fast and lightweight, but you cannot go back to previous rows.

  • Static cursor: A cursor that allows both forward and backward navigation. It provides

a snapshot of the data and remains unchanged even if the data in the database

changes during the operation. It is slower and consumes more memory compared to

a forward-only cursor.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

n ADO.NET DataProvider is a set of classes used to interact with different types of data

sources (such as SQL Server, Oracle, etc.). It provides methods for opening connections,

executing commands, and retrieving data.

The main types of DataProviders are:

  • SqlClient (for SQL Server)
  • OleDb (for OLE DB-compatible data sources)
  • Odbc (for ODBC-compatible data sources)
  • Oracle (for Oracle databases)
Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

llows you to define the name, data type, size, and value of a parameter. SqlParameter is

used to protect against SQL injection and to pass data to SQL queries safely.

Example:

SqlCommand command = new SqlCommand("SELECT * FROM Customers WHERE

CustomerID = @CustomerID", connection);

SqlParameter parameter = new SqlParameter("@CustomerID",

SqlDbType.Int);

parameter.Value = customerId;

command.Parameters.Add(parameter);

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

The SqlParameter class represents a parameter to a SQL command or stored procedure. It

allows you to define the name, data type, size, and value of a parameter. SqlParameter is

used to protect against SQL injection and to pass data to SQL queries safely.

Example:

SqlCommand command = new SqlCommand("SELECT * FROM Customers WHERE

CustomerID = @CustomerID", connection);

SqlParameter parameter = new SqlParameter("@CustomerID",

SqlDbType.Int);

parameter.Value = customerId;

command.Parameters.Add(parameter);

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Answer: Isolation levels define the level of visibility one transaction has into the changes made by other concurrent transactions. The four isolation levels in ADO.NET are:

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Batch processing allows you to execute multiple SQL commands in a single round trip to the

database, which can improve performance when you have a large number of operations to

perform.

You can use the SqlCommand object to execute a batch of SQL statements separated by

semicolons.

Example:

SqlCommand command = new SqlCommand();
command.Connection = connection;
command.CommandText = "INSERT INTO Customers (Name) VALUES ('John');

INSERT INTO Orders (OrderDate) VALUES ('2025-01-01');";

command.ExecuteNonQuery();

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

cross multiple data sources (e.g., SQL Server and other databases). It simplifies

transaction management by automatically handling the commit and rollback of transactions

cross multiple resources.

Example:

using (TransactionScope scope = new TransactionScope())
{

SqlConnection connection1 = new

SqlConnection(connectionString1);

SqlConnection connection2 = new

SqlConnection(connectionString2);

connection1.Open();

connection2.Open();

// Execute commands on both connections

scope.Complete(); // Commit the transaction if everything is

successful

}
Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

The TransactionScope class in ADO.NET is used to handle distributed transactions

across multiple data sources (e.g., SQL Server and other databases). It simplifies

transaction management by automatically handling the commit and rollback of transactions

across multiple resources.

Example:

using (TransactionScope scope = new TransactionScope())

SqlConnection connection1 = new

SqlConnection(connectionString1);

SqlConnection connection2 = new

SqlConnection(connectionString2);

connection1.Open();

connection2.Open();

// Execute commands on both connections

scope.Complete(); // Commit the transaction if everything is

successful

Follow:

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

The UpdateCommand property of the DataAdapter specifies the SQL command used to

update the database when changes are made to the data in the DataSet. The Update()

method of the DataAdapter uses the UpdateCommand to push changes back to the

database.

Example:

SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM

Customers", connection);

adapter.UpdateCommand = new SqlCommand("UPDATE Customers SET Name =

@Name WHERE CustomerID = @CustomerID", connection);

adapter.UpdateCommand.Parameters.Add("@Name", SqlDbType.NVarChar,

100, "Name");

adapter.UpdateCommand.Parameters.Add("@CustomerID", SqlDbType.Int,

4, "CustomerID");

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

dapter.UpdateCommand = new SqlCommand("UPDATE Customers SET Name =

@Name WHERE CustomerID = @CustomerID", connection);

dapter.UpdateCommand.Parameters.Add("@Name", SqlDbType.NVarChar,

100, "Name");

dapter.UpdateCommand.Parameters.Add("@CustomerID", SqlDbType.Int,

4, "CustomerID");

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

concurrency in ADO.NET.

  • Optimistic Concurrency: Assumes that data conflicts are rare. It allows multiple

users to read and modify the data without locking the record. However, when

updating, it checks if the data has been modified by another user since it was last

read.

  • Pessimistic Concurrency: Locks the data when it's being read or modified,

preventing other users from accessing it until the transaction is complete. It can

reduce conflicts but may result in performance issues.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

  • Data-Bound Controls: These controls automatically bind to a data source, such as a

DataSet or DataTable, and update the UI when the data changes. Examples include

GridView, DropDownList, and ListBox.

  • Manually Bound Controls: These controls do not automatically update when the

data changes. You need to manually manage data binding, such as updating the

display values when the data changes.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Performance can be optimized by:

  • Using DataReader for large result sets.
  • Using parameterized queries to avoid SQL injection and improve performance.
  • Enabling connection pooling to reduce the overhead of opening and closing

database connections.

  • Using asynchronous operations to prevent blocking the main thread.
  • Minimizing the number of round trips to the database.
Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

  • Memory Consumption: A DataSet loads the entire result set into memory, which

can lead to high memory usage, especially with large datasets.

  • Performance: Since DataSet is an in-memory representation of data, it can be

slower compared to DataReader for large result sets or when working with large

amounts of data.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

The DataReader is more efficient than DataSet when dealing with large result sets because

it reads data in a forward-only, read-only manner, without storing the entire result set in

memory. This results in better performance and lower memory consumption.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Paging is implemented by retrieving a subset of data, typically using SQL's LIMIT (MySQL),

TOP (SQL Server), or ROWNUM (Oracle) to limit the number of rows returned.

Example (SQL Server):

SqlCommand command = new SqlCommand("SELECT * FROM Customers ORDER

BY CustomerID OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY", connection);

SqlDataReader reader = command.ExecuteReader();
Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Stored procedure parameters are handled by adding SqlParameter objects to the

SqlCommand's Parameters collection. You set the parameter name, data type, and value.

Example:

SqlCommand command = new SqlCommand("GetCustomerDetails",

connection);

command.CommandType = CommandType.StoredProcedure;

command.Parameters.AddWithValue("@CustomerID", customerId);

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

DataRelation defines a relationship between two DataTable objects in a DataSet. It is

used to enforce referential integrity and allows for navigating between related data in a

parent-child relationship.

Example:

DataRelation relation = new DataRelation("ParentChild",

parentTable.Columns["ID"], childTable.Columns["ParentID"]);

dataSet.Relations.Add(relation);

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

DO.NET supports several types of locks during transactions:

  • Shared Lock (S): Allows other transactions to read but not modify the locked data.
  • Exclusive Lock (X): Prevents other transactions from reading or modifying the

locked data.

  • Update Lock (U): Allows reading, but prevents other transactions from acquiring an

exclusive lock.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Connection Pooling is a technique used to optimize the performance of database

connections in ADO.NET. When an application opens a connection to a database, the

connection is not always closed immediately. Instead, it is placed in a connection pool for

reuse by future requests. This avoids the overhead of repeatedly opening and closing

connections to the database.

Key Points:

  • When a connection is closed, it is not actually destroyed. Instead, it is returned to

the pool, making it available for reuse.

  • Connection Pooling is managed automatically by ADO.NET; developers do not

need to handle the pool directly.

  • Connection pooling works by maintaining a pool of database connections for reuse.

When a connection is needed, one is retrieved from the pool; when it is no longer

needed, it is returned to the pool.

Benefits:

  • Reduces the overhead of opening and closing database connections.
  • Improves application performance by reusing existing connections.

Example:

// The connection string should have pooling enabled by default

string connectionString =
"Server=myServerAddress;Database=myDataBase;Integrated
Security=True;Pooling=True;Max Pool Size=100;";

// Use SqlConnection as usual

SqlConnection connection = new SqlConnection(connectionString);

connection.Open();

The Pooling=True in the connection string ensures that the connections are pooled.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

The ExecuteScalar method in ADO.NET is used to execute a query that returns a single

value, typically an aggregate value like a count, sum, or average, or a single field from a row.

This method is ideal when you expect a single value as the result, rather than a set of rows.

Key Points:

  • It returns the first column of the first row in the result set. Any other columns or

rows are ignored.

  • It is commonly used for queries that return a single value (e.g., COUNT(), MAX(),

MIN()).

Example:

SqlCommand command = new SqlCommand("SELECT COUNT(*) FROM

Customers", connection);

connection.Open();

int customerCount = (int)command.ExecuteScalar();

Console.WriteLine("Number of customers: " + customerCount);

In this example, ExecuteScalar returns the number of rows in the Customers table.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

nd columns, and it is used to hold data returned from the database.

Key Features:

  • Can hold data from one table.
  • Provides methods for data manipulation (e.g., adding, deleting, modifying

rows).

  • Can be filled with data from a DataAdapter.

Example:

DataTable table = new DataTable();

table.Columns.Add("ID");

table.Columns.Add("Name");

table.Rows.Add(1, "Alice");

table.Rows.Add(2, "Bob");

  • ● DataView: Provides a way to view and filter data from a DataTable without changing

the underlying data. It allows you to sort and filter the data dynamically.

Key Features:

  • Acts as a view of a DataTable.
  • Allows for sorting, filtering, and searching the data.
  • It does not modify the underlying DataTable.

Example:

DataView view = new DataView(table);
view.RowFilter = "Name = 'Alice'";
view.Sort = "ID DESC";
  • Summary:
  • DataTable holds data, and DataView provides a dynamic view (filtering, sorting) of

the DataTable.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Both DataTable and DataView are used to represent data in ADO.NET, but they have

different purposes:

  • DataTable: Represents a single table of data in-memory. It is a container for rows

and columns, and it is used to hold data returned from the database.

Key Features:

Follow:

  • Can hold data from one table.
  • Provides methods for data manipulation (e.g., adding, deleting, modifying

rows).

  • Can be filled with data from a DataAdapter.

Example:

DataTable table = new DataTable();

table.Columns.Add("ID");

table.Columns.Add("Name");

table.Rows.Add(1, "Alice");

table.Rows.Add(2, "Bob");

  • DataView: Provides a way to view and filter data from a DataTable without changing

the underlying data. It allows you to sort and filter the data dynamically.

Key Features:

  • Acts as a view of a DataTable.
  • Allows for sorting, filtering, and searching the data.
  • It does not modify the underlying DataTable.

Example:

DataView view = new DataView(table);

view.RowFilter = "Name = 'Alice'";

view.Sort = "ID DESC";

Summary:

  • DataTable holds data, and DataView provides a dynamic view (filtering, sorting) of

the DataTable.

Follow:

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Answer: DataReader offers significant performance advantages over DataSet in specific scenarios, especially when you are working with large volumes of data:

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

DO.NET?

To retrieve a single row or column of data, you can use a SqlCommand and either execute

it with ExecuteScalar (for single column data) or ExecuteReader (for a single row).

Using ExecuteScalar (for a single column value, like an aggregate):

SqlCommand command = new SqlCommand("SELECT CustomerName FROM

Customers WHERE CustomerID = @CustomerID", connection);

command.Parameters.AddWithValue("@CustomerID", 1);

connection.Open();

string customerName = (string)command.ExecuteScalar();

Console.WriteLine("Customer Name: " + customerName);

connection.Close();

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

To retrieve a single row or column of data, you can use a SqlCommand and either execute

it with ExecuteScalar (for single column data) or ExecuteReader (for a single row).

Using ExecuteScalar (for a single column value, like an aggregate):

SqlCommand command = new SqlCommand("SELECT CustomerName FROM

Customers WHERE CustomerID = @CustomerID", connection);

command.Parameters.AddWithValue("@CustomerID", 1);

connection.Open();

string customerName = (string)command.ExecuteScalar();

Console.WriteLine("Customer Name: " + customerName);

connection.Close();

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Answer: You can fetch data from multiple tables in ADO.NET using various SQL techniques, such as JOINs (e.g., INNER JOIN, LEFT JOIN) or subqueries. Steps:

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Answer: nd sync with the database? To update multiple records in a DataTable and sync the changes with the database, you need to follow these steps:

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Answer: To update multiple records in a DataTable and sync the changes with the database, you need to follow these steps:

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Answer: In an ASP.NET WebForms application, you can use the GridView control to display data from a database by following these steps:

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Answer: When working with large datasets in ADO.NET, it's crucial to ensure that the application does not run into performance issues, such as excessive memory usage or long wait times. Here are some strategies to efficiently retrieve large data:

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Answer: Concurrency issues occur when multiple users attempt to update the same data simultaneously. There are two main strategies to handle concurrency in ADO.NET:

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Answer: DO.NET? Concurrency issues occur when multiple users attempt to update the same data simultaneously. There are two main strategies to handle concurrency in ADO.NET:

What interviewers expect

  • A clear definition tied to ADO.NET in ADO.NET projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ADO.NET architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

Data validation ensures that the data being inserted into the database is correct and

consistent. You can perform validation at various stages, including the client side (e.g.,

using JavaScript in a web application) and server side (using ADO.NET).

Steps for Server-Side Validation:

Permalink

ADO.NET ADO.NET Core Tutorial · ADO.NET

The BatchUpdate method is used to send multiple SQL commands (such as insert, update,

or delete) in a single round trip to the database. This improves performance by reducing the

overhead of sending multiple individual commands.

While BatchUpdate isn't directly exposed as a method on the DataAdapter object, you

can achieve similar functionality by manually creating a batch of commands and executing

them in a single call.

Example (Using SqlDataAdapter):

SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM

Customers", connection);

SqlCommandBuilder builder = new SqlCommandBuilder(adapter); //

Automatically generates commands for Update, Insert, and Delete

DataTable table = new DataTable();

adapter.Fill(table);

// Modify DataTable as needed

// Update changes to the database in one go (BatchUpdate)

adapter.Update(table);

Follow:

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Filters are ASP.NET Core’s plug-in points that allow you to inject logic before or after

specific pipeline stages such as:

  • Authorization
  • Resource execution
  • Action execution
  • Results processing
  • Exception handling

They help you implement cross-cutting concerns without cluttering controllers or actions.

In enterprise systems, filters are indispensable for:

  • Logging
  • Validation
  • Authorization
  • Error handling
  • Performance profiling
  • Policy enforcement
Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: filter is a component that allows logic to be executed before or after parts of the request pipeline, such as authorization, action execution, or result processing.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Middleware is a component in the HTTP request pipeline that can:

  • Handle requests,
  • Pass requests to the next middleware,
  • Or short-circuit the pipeline.

Middleware can:

  • Perform actions before and/or after the next middleware executes.
  • Be used for logging, authentication, error handling, etc.

Middleware executes in the order it's added in Program.cs.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

uthorization checks directly inside controllers. This led to:

  • Repetition
  • Hard-to-test classes
  • Cross-cutting concerns polluting business logic
  • Fragile code

Filters solve these by offering centralized, consistent, and reusable implementation points.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

pp.UseMiddleware<YourMiddleware>();

pp.UseRouting();

pp.UseEndpoints(endpoints => { endpoints.MapControllers();

});

pp.Run();

  • In older versions (e.g., .NET Core 3.1), Startup.cs is used:
public void Configure(IApplicationBuilder app,

IWebHostEnvironment env)

{

pp.UseMiddleware<YourMiddleware>();

pp.UseRouting();

pp.UseEndpoints(endpoints => {

endpoints.MapControllers(); });

}
Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

uthorization, Resource, Action, Exception, and Result filters.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

  • In ASP.NET Core 6+ (minimal hosting model), middleware is added in

Program.cs:

var builder = WebApplication.CreateBuilder(args);

var app = builder.Build();

app.UseMiddleware<YourMiddleware>();

app.UseRouting();

app.UseEndpoints(endpoints => { endpoints.MapControllers();

});

app.Run();

  • In older versions (e.g., .NET Core 3.1), Startup.cs is used:

public void Configure(IApplicationBuilder app,

IWebHostEnvironment env)

app.UseMiddleware<YourMiddleware>();

app.UseRouting();

app.UseEndpoints(endpoints => {

endpoints.MapControllers(); });

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

uthorization Before everything Identity, JWT, RBAC

Resource Before model binding Caching, request trimming

ction Before/after action Logging, validation

Exception On unhandled errors Global error handling

Result Before/after result Response wrapping,

formatting

Endpoint (ASP.NET Core

7+)

round minimal API

endpoints

Logging, validation

3.1 Authorization Filters

These execute first, determining whether the user can access the route.

Typical use cases:

  • Restrict admin-only operations
  • Validate JWT tokens
  • Validate API keys

3.2 Resource Filters

Executed before model binding.

Perfect for:

  • Caching
  • Request size validation
  • Global input sanitation

3.3 Action Filters

The most commonly used filter type.

Great for:

  • Logging
  • Auditing
  • Validation rules
  • Pre/post business logic wrappers

Example – Audit Logging Filter

public class AuditLogFilter : IActionFilter
{
private readonly ILogger<AuditLogFilter> _logger;
public AuditLogFilter(ILogger<AuditLogFilter> logger)
{
_logger = logger;
}
public void OnActionExecuting(ActionExecutingContext context)
{

_logger.LogInformation("Request started at: {time}",

DateTime.UtcNow);

}
public void OnActionExecuted(ActionExecutedContext context)
{

_logger.LogInformation("Request ended at: {time}",

DateTime.UtcNow);

}
}

3.4 Exception Filters

Centralizing error handling is vital in fintech and healthcare APIs.

Example use cases:

  • Returning consistent error envelopes
  • Logging unhandled exceptions
  • Protecting internal stack traces

3.5 Result Filters

These wrap the response.

Use cases:

  • Response compression
  • Standardizing API responses
  • Masking sensitive data

3.6 Endpoint Filters (ASP.NET Core 7+)

Primarily for minimal APIs.

Example use cases:

  • Request validation
  • Logging
  • Caching
  • Response transformation

pp.MapGet("/users/{id}", (int id) => GetUser(id))

.AddEndpointFilter(new LoggingEndpointFilter());

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Example – Using ServiceFilter [ServiceFilter(typeof(AuditLogFilter))] public class UserController : ControllerBase { }

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Authorization Filters Resource Filters Action Filters Exception Filters Result Filters Endpoint Filters (ASP.NET Core 7+)

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Filters promote reusability, separation of concerns, cleaner controllers, and easier maintenance.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

pp.Map

Method Description

pp.Use Adds middleware that can call next in the

pipeline.

pp.UseMiddlewar

e<T>()

dds a custom middleware class.

pp.Run Terminal middleware – does not call next. Ends

the pipeline.

pp.Map Branches the pipeline based on URL path (e.g.

/api).

Example:

pp.Use(async (context, next) => {

wait next(); // go to next middleware

});

pp.Run(async context => {

wait context.Response.WriteAsync("Hello World"); //

terminates pipeline

});

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Create a class with:

  • A constructor accepting RequestDelegate
  • An Invoke or InvokeAsync method

public class MyCustomMiddleware

private readonly RequestDelegate _next;

public MyCustomMiddleware(RequestDelegate next) => _next =

next;

public async Task InvokeAsync(HttpContext context)

// Pre-processing logic

await _next(context);

// Post-processing logic

Register it:

app.UseMiddleware<MyCustomMiddleware>();

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Diagram)

  • --------------------------

| Authorization Filter |

  • --------------------------
  • --------------------------

| Resource Filter |

  • --------------------------
  • --------------------------

| Model Binding Happens |

  • --------------------------
  • --------------------------

| Action Filter |

  • --------------------------
  • --------------------------

| Action Method |

  • --------------------------
  • --------------------------

| Result Filter |

  • --------------------------
  • --------------------------

| Response Returned |

  • --------------------------
Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: wait _next(context); // Post-processing logic } } Register it: pp.UseMiddleware&lt;MyCustomMiddleware&gt;();

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: ction filters wrap the action method; result filters wrap the returned result (like ObjectResult or ViewResult).

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Filters can be created using:

  • Interfaces (IActionFilter, IAsyncActionFilter…)
  • Attributes
  • Dependency injection

Example – Custom Header Validation Filter

public class HeaderValidationFilter : IActionFilter
{
public void OnActionExecuting(ActionExecutingContext context)
{
if

(!context.HttpContext.Request.Headers.ContainsKey("X-Client-Id"))

{

context.Result = new BadRequestObjectResult("Missing

X-Client-Id header.");

}
}
public void OnActionExecuted(ActionExecutedContext context) { }
}
Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

uthorization filters always run first. Intermediate Level

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: RequestDelegate is a delegate representing the next middleware in the pipeline: public delegate Task RequestDelegate(HttpContext context); In custom middleware, it allows passing control to the next component.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: pp.UseAuthentication(); // Must come before authorization pp.UseAuthorization(); pp.UseEndpoints(...); Logging, error handling, and security middlewares must be early in the pipeline.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Middleware is executed in the order it's added, and this order affects

behavior.

Example:

app.UseAuthentication(); // Must come before authorization

app.UseAuthorization();

app.UseEndpoints(...);

Logging, error handling, and security middlewares must be early

in the pipeline.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: They run before model binding and after authorization. Perfect for caching or request trimming.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

✔ Use Filters When:

  • You need information about controller or action context
  • You need pre/post action execution access
  • Logic must execute only on MVC actions

❌ Avoid Filters If:

  • Logic applies to all HTTP requests → use middleware
  • Heavy database operations are needed in every request

⚠ Pitfall: Filters run per action. Be mindful of expensive operations.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Simply don’t call await next() in a middleware: if (!context.User.Identity.IsAuthenticated) context.Response.StatusCode = 401; return; // Short-circuits await next(); // only called if authenticated

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Set context.Result = new BadRequestObjectResult(...).

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

wait next(); // only called if authenticated

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Concern Use Filter Use Middleware

Needs controller context ✔ ❌

Needs access before

routing

❌ ✔

Validating request body ❌ ✔

Logging per action ✔ ❌

Exception handling ✔ ✔

💡 Tip: If your logic is unrelated to MVC actions (e.g., CORS, compression),

middleware is the right choice.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: pp.UseStaticFiles() enables serving files from wwwroot. Important: It must be added before routing or endpoints so static files re served without invoking controller logic. pp.UseStaticFiles(); pp.UseRouting(); pp.UseEndpoints(...);

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Yes—via constructor injection, ServiceFilter, or TypeFilter.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

SP.NET Core filters support DI via:

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: sync filters implement IAsyncActionFilter and support await, improving scalability.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

custom page or handler.

Example:

if (env.IsDevelopment())

pp.UseDeveloperExceptionPage();

else

pp.UseExceptionHandler("/Error");

Or inline:

pp.UseExceptionHandler(errorApp =>

{

errorApp.Run(async context =>

{
context.Response.StatusCode = 500;

wait context.Response.WriteAsync("An error

occurred");

});

});

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

🏦 Fintech API – Global Exception Filter

Ensures consistent error envelopes across microservices.

🛠 Microservices – Audit Logging

Tracks when sensitive controller actions are executed.

👮 Role-based Authorization

Custom authorization filter validating role claims dynamically.

🚀 Performance Profiling

Times how long each controller method takes.

public class ProfilingFilter : IActionFilter
{
private Stopwatch _watch;
public void OnActionExecuting(ActionExecutingContext context)
{
_watch = Stopwatch.StartNew();
}
public void OnActionExecuted(ActionExecutedContext context)
{

_watch.Stop();

Console.WriteLine($"Action took {_watch.ElapsedMilliseconds}

ms");

}
}
Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

(UseExceptionHandler, UseDeveloperExceptionPage)

  • UseDeveloperExceptionPage() shows detailed errors (development

only).

  • UseExceptionHandler("/Error") handles errors in production with

a custom page or handler.

Example:

if (env.IsDevelopment())

app.UseDeveloperExceptionPage();

else

app.UseExceptionHandler("/Error");

Or inline:

app.UseExceptionHandler(errorApp =>

errorApp.Run(async context =>

context.Response.StatusCode = 500;

await context.Response.WriteAsync("An error

occurred");

});

});

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Redirects HTTP requests to HTTPS. app.UseHttpsRedirection(); Add early in the pipeline, before auth or routing. You can configure HTTPS ports in launchSettings.json or appsettings.json.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Filters execute per controller action → use sparingly. Avoid heavy DB calls. Avoid creating new HttpClients or DbContexts inside filters. Prefer asynchronous filters.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: pp.UseHttpsRedirection(); dd early in the pipeline, before auth or routing. You can configure HTTPS ports in launchSettings.json or ppsettings.json.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Yes. They form a pipeline based on their defined order.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

pp.UseStaticFiles(new StaticFileOptions

{

FileProvider = new

PhysicalFileProvider(Path.Combine(env.ContentRootPath,

"MyFiles")),

RequestPath = "/Files",

OnPrepareResponse = ctx =>

{

ctx.Context.Response.Headers.Append("Cache-Control",

"public,max-age=600");
}

});

For directory browsing:

pp.UseDirectoryBrowser(new DirectoryBrowserOptions

{

FileProvider = new PhysicalFileProvider("path"),

RequestPath = "/browse"

});

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Use:

  • ActionExecutingContext mocks
  • ActionExecutedContext mocks
  • DefaultHttpContext
var httpContext = new DefaultHttpContext();
var context = new ActionExecutingContext(...);

Focus tests on:

  • Expected results
  • Short-circuiting behavior
  • Context manipulation
Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

The sequence in which filters run. Lower Order value = earlier execution.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

middleware

Type Description

Terminal Ends the pipeline. Doesn’t call next(). E.g., app.Run()

Non-Termi

nal

Calls next() and allows other middlewares to run after it.

E.g., app.Use()

Terminal middleware:

app.Run(async ctx => {

await ctx.Response.WriteAsync("This ends the pipeline");

});

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Mistake Fix

Doing authentication inside action filters Use authorization filters

Performing heavy logic Move to middleware

Not registering filters as services Use DI for maintainability

Returning inconsistent error messages Handle errors via global exception filter
Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: pp.Run(async ctx =&gt; { wait ctx.Response.WriteAsync("This ends the pipeline"); });

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Yes—action filters have full access to ActionArguments.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

pp.UseAuthentication(); // Validates user identity

pp.UseAuthorization(); // Applies policies/roles

Order matters: must be after routing but before endpoints.

pp.UseRouting();

pp.UseAuthentication();

pp.UseAuthorization();

pp.UseEndpoints(...);

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Exception filters only catch exceptions from MVC actions; middleware catches exceptions from the entire pipeline.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

  • Filters provide clean, reusable cross-cutting logic for MVC pipelines.
  • Use the right filter type for the right stage.
  • Prefer middleware when you don’t need controller context.
  • Exception filters are best for consistent error handling.
  • Use DI for scalable, clean, testable filter implementations.
  • Filters shine in enterprise applications: auditing, authorization, and response shaping.
Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: builder.Services.AddCors(options =&gt; options.AddPolicy("MyPolicy", policy =&gt; policy.WithOrigins(" .AllowAnyHeader() .AllowAnyMethod(); }); }); app.UseCors("MyPolicy"); Must be placed before routing/endpoints.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

pp.UseCors("MyPolicy"); Must be placed before routing/endpoints.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

execution time)

Example custom middleware to measure time:

public class TimingMiddleware

private readonly RequestDelegate _next;

public TimingMiddleware(RequestDelegate next) => _next =

next;

public async Task InvokeAsync(HttpContext context)

var sw = Stopwatch.StartNew();

await _next(context);

sw.Stop();

Console.WriteLine($"Request took

{sw.ElapsedMilliseconds} ms");

Register:

app.UseMiddleware<TimingMiddleware>();

Dependency Injection (DI)

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: wait _next(context); sw.Stop(); Console.WriteLine($"Request took {sw.ElapsedMilliseconds} ms"); } } Register: pp.UseMiddleware&lt;TimingMiddleware&gt;(); Dependency Injection (DI)

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Dependency Injection (DI) is a design pattern that allows you to inject dependencies (services) into classes instead of hard-coding them.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Caching expensive requests where model binding is unnecessary.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

✅ Capabilities:

  • Constructor injection
  • Lifetime management (Transient, Scoped, Singleton)
  • Supports IEnumerable<T>, IServiceProvider, and open generics

⚠ Limitations:

  • No support for named registrations
  • Limited property injection
  • Basic feature set compared to Autofac or other 3rd-party containers
Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Filters specifically built for Minimal APIs (introduced in ASP.NET Core 7).

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Lifetime Description Use Case Example Transient New instance every time Lightweight stateless services Scoped One instance per request Database context, UoW Singleto One instance for the app's lifetime Logging, Config access

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Used for filters that require custom instantiation logic.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Lower order executes first on entry but last on exit—like nested layers.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: public void ConfigureServices(IServiceCollection services) { services.AddTransient&lt;IMyService, MyService&gt;(); services.AddScoped&lt;IRepository, Repository&gt;(); services.AddSingleton&lt;ILoggerService, LoggerService&gt;(); }

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Controllers: Constructor injection Razor Pages: Constructor injection in PageModel Middleware: Inject via constructor or use IApplicationBuilder.ApplicationServices

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Use a mocked HttpContext and assert on changes.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Constructor Injection: Supported and preferred in ASP.NET Core. Property Injection: Not supported natively in built-in DI; can be achieved via custom logic or 3rd-party containers. ✅ Use constructor injection for immutability and clarity.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Use [SkipFilter] custom attribute or exclude via filter predicates.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

  • IServiceProvider: Resolves services manually.
  • IServiceScopeFactory: Creates a new DI scope (useful for background tasks).
using (var scope = serviceScopeFactory.CreateScope())
{
var scopedService =

scope.ServiceProvider.GetRequiredService<IMyScopedService>();

}
Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

No. But middleware can replace some filter use cases.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Scoped services are tied to the HTTP request lifecycle. In background tasks, you must manually create a scope using IServiceScopeFactory to resolve scoped services safely.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Middleware logs incoming requests; action filter logs controller-level execution.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: To replace: services.AddSingleton&lt;IService, CustomImplementation&gt;(); To remove: var descriptor = services.First(x =&gt; x.ServiceType == typeof(IMyService)); services.Remove(descriptor);

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Mixing sync &amp; async can cause deadlocks. Prefer async filters.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

IOptionsMonitor)

  • IOptions<T>: For singleton/config services.
  • IOptionsSnapshot<T>: Scoped; updates per request.
  • IOptionsMonitor<T>: Singleton; can react to config changes.

services.Configure<MySettings>(Configuration.GetSection("MySettings"

));

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Yes—but avoid heavy operations that run per action.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: there Use IHostedService or BackgroundService for tasks that run in the background. Services are injected via constructor. Scoped services must use IServiceScopeFactory.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Use IOptions or DI into constructor.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: IConfiguration is automatically registered and injected via constructor. public MyService(IConfiguration config) { var key = config["MyKey"]; }

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

When exceptions must be caught outside MVC (e.g., authorization failures).

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

SP.NET Core provides structured logging via ILogger<T>.

public class MyService
{
private readonly ILogger<MyService> _logger;
public MyService(ILogger<MyService> logger) => _logger = logger;
public void DoSomething() => _logger.LogInformation("Action

performed");

}
Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

dd custom validation and authorization filters using .AddEndpointFilter().

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Yes—result filters can wrap or modify responses.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Occurs when two services depend on each other directly or indirectly. 🛠 Fix: Refactor to remove circular reference Use Lazy&lt;T&gt; or factory injection Split responsibilities

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

filter that tracks performance of controller actions:

public class ProfilingFilter : IAsyncActionFilter
{
public async Task OnActionExecutionAsync(

ctionExecutingContext context, ActionExecutionDelegate

next)

{
var sw = Stopwatch.StartNew();
var result = await next();

sw.Stop();

Console.WriteLine($"Action took

{sw.ElapsedMilliseconds}ms");

}
}
Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Use a mocking framework like Moq:

var mockService = new Mock<IMyService>();
mockService.Setup(s => s.Get()).Returns("test");
var controller = new MyController(mockService.Object);

Mocking helps isolate the unit of work and test behavior independently.

MVC & Razor Pages

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

How does it differ from MVC in

“older” ASP.NET?

  • MVC (Model-View-Controller) is a pattern for organizing code into:
  • Model: Data and business logic
  • View: UI rendering
  • Controller: Input handling and app flow

🔹 Key differences in ASP.NET Core:

  • Built on a modular, cross-platform framework.
  • Uses dependency injection by default.
  • Unified Web API + MVC pipeline.
  • Lightweight and middleware-based request processing.
Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

  • MVC (Model-View-Controller) is a pattern for organizing code into:
  • Model: Data and business logic
  • View: UI rendering
  • Controller: Input handling and app flow
  • Built on a modular, cross-platform framework.
  • Uses dependency injection by default.
  • Unified Web API + MVC pipeline.
  • Lightweight and middleware-based request processing.
Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

When to use Razor Pages instead of

MVC?

  • Razor Pages is a page-based programming model introduced in

ASP.NET Core 2.0.

  • Each .cshtml file has an associated PageModel class (like a view +

controller combined).

  • Best for simple UI-focused apps or CRUD pages.

✅ Use Razor Pages for:

  • Simpler, page-focused apps

✅ Use MVC for:

  • Complex, controller-based routing or large, structured apps
Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

SP.NET Core 2.0.

  • Each .cshtml file has an associated PageModel class (like a view +

controller combined).

  • Best for simple UI-focused apps or CRUD pages.

✅ Use Razor Pages for:

  • Simpler, page-focused apps

✅ Use MVC for:

  • Complex, controller-based routing or large, structured apps
Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: }"); Razor Pages Routing: Based on folder structure. URL /Products/Edit maps to /Pages/Products/Edit.cshtml.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

  • MVC Routing:
  • Uses attribute routing or conventional routing.

Example:

endpoints.MapControllerRoute(

name: "default",

pattern: "{controller=Home}/{action=Index}/{id?}");
  • Razor Pages Routing:
  • Based on folder structure.
  • URL /Products/Edit maps to

/Pages/Products/Edit.cshtml.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: view or JSON). View: .cshtml file that renders HTML. View Component: Reusable mini-views with logic (like partials but with code-behind).

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

  • Controller: Handles HTTP requests.
  • Action Method: A method in the controller that returns a result (like

a view or JSON).

  • View: .cshtml file that renders HTML.
  • View Component: Reusable mini-views with logic (like partials but

with code-behind).

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Tag Helpers: Use HTML-like syntax. Easier to read/maintain.

<form asp-controller="Home" asp-action="Login"></form>

  • HTML Helpers: C# methods used in Razor.

@Html.BeginForm("Login", "Home")

  • ✅ Prefer Tag Helpers in modern ASP.NET Core apps.
Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

ta cross requests No Preserved for 1 redirect only

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Purpose ViewDa Current request No Pass data to views ViewBa Current request Yes ViewData wrapper (dynamic) TempD ata Across requests No Preserved for 1 redirect only

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Automatically maps form values, query strings, route data to C# model properties. public IActionResult Submit(User user) { ... } Binds complex types and simple types out-of-the-box.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Decorate model properties: public class User { [Required] [EmailAddress] public string Email { get; set; } } Automatically validated during model binding. Use ModelState.IsValid to check.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: IValidatableObject: public IEnumerable&lt;ValidationResult&gt; Validate(ValidationContext context) Custom Attribute: public class MyCustomAttribute : ValidationAttribute { public override bool IsValid(object value) { ... } }

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

  • Layouts: Shared structure (e.g. header, footer) using

_Layout.cshtml.

  • Partial Views: Reusable UI snippets (_LoginPartial.cshtml).
  • View Components: Partial views with logic.
public class CartViewComponent : ViewComponent {
public IViewComponentResult Invoke() => View("Cart",

model);

}
Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Via ViewBag / ViewData / Model: return View(model); // Strongly typed ViewBag.Message = "Hello"; ViewData["Count"] = 5;

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: ActionFilter: Runs before/after action method. ResultFilter: Runs before/after view result. ExceptionFilter: Catches unhandled exceptions. Apply globally or via attributes. public class LogActionFilter : IActionFilter { ... }

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Razor Pages use handler methods: public class IndexModel : PageModel { public void OnGet() { ... } public IActionResult OnPost() { ... } } You can use asp-page-handler="Update" for custom methods.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Inject services into PageModel constructor: public IndexModel(IMyService service) { ... } Also available in Razor views via @inject: @inject ILogger&lt;MyPage&gt; Logger

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Reusable libraries that contain Razor views, pages, static files, etc. Share UI components across multiple projects. dotnet new razorclasslib

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Used to organize large applications into sections (e.g., Admin, Customer). Each Area has its own Controllers/Views/Models. [Area("Admin")] public class DashboardController : Controller { ... }

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Handled via: ASP.NET Core Middleware WebOptimizer, Gulp, or Webpack Static files in wwwroot/ Enable in Startup.cs: app.UseStaticFiles();

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: ASP.NET Core supports Razor by default. You can add support for custom view engines by implementing IViewEngine.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Use IStringLocalizer&lt;T&gt; or IViewLocalizer: @inject IViewLocalizer Localizer &lt;h1&gt;@Localizer["Welcome"]&lt;/h1&gt; Add resource .resx files for each language.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

  • Performance: Very similar, both use Razor rendering.
  • Simplicity: Razor Pages have less boilerplate for page-based UIs.
  • Maintainability: Razor Pages better for small apps, MVC better for

large, modular apps.

Web API (RESTful Services)

Web API (RESTful Services)

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

How to design RESTful APIs in ASP.NET Core

REST (Representational State Transfer) is an architectural style for

building scalable web services. RESTful APIs follow standard HTTP

methods (GET, POST, PUT, DELETE) and stateless communication.

✅ Key principles for RESTful API in ASP.NET Core:

  • Use HTTP verbs for operations.
  • Use nouns (resources) in URIs, not verbs.
  • Support stateless operations.
  • Return appropriate HTTP status codes.
  • Implement HATEOAS (optional for hypermedia).
Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

REST (Representational State Transfer) is an architectural style for

building scalable web services. RESTful APIs follow standard HTTP

methods (GET, POST, PUT, DELETE) and stateless communication.

✅ Key principles for RESTful API in ASP.NET Core:

  • Use HTTP verbs for operations.
  • Use nouns (resources) in URIs, not verbs.
  • Support stateless operations.
  • Return appropriate HTTP status codes.
  • Implement HATEOAS (optional for hypermedia).
Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

The [ApiController] attribute is used to denote Web API controllers in

ASP.NET Core.

✅ Benefits:

  • Automatic model validation
  • Infer [FromBody] / [FromQuery], etc.
  • 400 BadRequest returned automatically if model state is invalid.
  • Improved parameter binding behavior
Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: SP.NET Core. ✅ Benefits: Automatic model validation Infer [FromBody] / [FromQuery], etc. 400 BadRequest returned automatically if model state is invalid. Improved parameter binding behavior

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

templates)

  • Attribute Routing (Preferred):

[Route("api/products")]

[ApiController]

public class ProductsController : ControllerBase {

[HttpGet("{id}")]

public IActionResult Get(int id) { ... }
}
  • Route Templates:

Use placeholders like {id}, constraints like {id:int}.

You can also define route prefixes at controller level and use relative routes

in actions.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

media type versioning)

Use Microsoft.AspNetCore.Mvc.Versioning package.

✅ Supported methods:

  • URL versioning: /api/v1/products
  • Header versioning: X-API-Version: 1.0
  • Media Type versioning: Accept:

application/vnd.company.v1+json

services.AddApiVersioning(options => {

options.ReportApiVersions = true;

options.AssumeDefaultVersionWhenUnspecified = true;

options.DefaultApiVersion = new ApiVersion(1, 0);

});

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: pplication/vnd.company.v1+json services.AddApiVersioning(options =&gt; { options.ReportApiVersions = true; options.AssumeDefaultVersionWhenUnspecified = true; options.DefaultApiVersion = new ApiVersion(1, 0); });

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: SP.NET Core selects the response format based on the Accept header. JSON is the default. To add XML: services.AddControllers() .AddXmlSerializerFormatters(); ccept: application/xml

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: form Source Attribute Body [FromBody Query string [FromQuer Route [FromRout Form data [FromForm Header [FromHear ASP.NET Core infers the source when possible.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

SP.NET Core infers the source when possible.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: For large uploads, use IFormFile, Stream, or read from Request.Body for streaming. For downloads, return FileStreamResult. Enable buffering or streaming to avoid memory overload.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Use UseExceptionHandler middleware or custom ExceptionMiddleware.

You can also create a global error handler:

app.UseExceptionHandler(config => {

config.Run(async context => {

// Log and return problem details

});

});

Or use ProblemDetails for structured error responses.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: pp.UseExceptionHandler(config =&gt; { config.Run(async context =&gt; { // Log and return problem details }); }); Or use ProblemDetails for structured error responses.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Use proper status codes:

  • 200 OK (success)
  • 201 Created (on POST)
  • 204 No Content (on DELETE)
  • 400 Bad Request
  • 401 Unauthorized / 403 Forbidden
  • 404 Not Found
  • 500 Internal Server Error
return Ok(result);
return NotFound();
return BadRequest(ModelState);
Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

  • ActionResult<T>: Combines a return value and response code.
public ActionResult<Product> Get(int id) { ... }
  • IActionResult: More flexible, returns different result types explicitly.

Prefer ActionResult<T> for simpler, strongly-typed APIs.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

NotFound() : Ok(product); ✅ Improves scalability and performance.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

SP.NET Core supports full async/await pattern for IO-bound tasks.

[HttpGet]

public async Task<ActionResult<Product>> GetAsync(int id) {
var product = await _repo.GetAsync(id);
return product == null ? NotFound() : Ok(product);
}

✅ Improves scalability and performance.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Enable CORS (Cross-Origin Resource Sharing) to allow client apps from

different domains:

services.AddCors(options => {

options.AddPolicy("AllowFrontend", builder =>

builder.WithOrigins("

.AllowAnyHeader()

.AllowAnyMethod());

});

app.UseCors("AllowFrontend");

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: It can enforce rate limiting to prevent abuse and throttling to limit the number of requests a client can make.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Use Swashbuckle.AspNetCore or NSwag for generating Swagger docs. services.AddSwaggerGen(); app.UseSwagger(); app.UseSwaggerUI(); Supports: Auto-generated OpenAPI docs Try it out interface Versioning support

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: pp.UseSwagger(); pp.UseSwaggerUI(); Supports: Auto-generated OpenAPI docs Try it out interface Versioning support

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

  • Unit testing: Mock services/repositories using Moq or FakeItEasy.
  • Integration testing: Use WebApplicationFactory<T> + TestServer

+ HttpClient.

var client = _factory.CreateClient();
var response = await client.GetAsync("/api/products");
Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

  • Use JWT Bearer Tokens for stateless auth:

services.AddAuthentication(JwtBearerDefaults.AuthenticationSch

eme)

.AddJwtBearer(options => { ... });
  • Secure endpoints with:

[Authorize(Roles = "Admin")]

  • OAuth supported via IdentityServer, Azure AD, or external

providers.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: HTTPS: Enforced via UseHttpsRedirection() CORS: Limit origins using policies Anti-forgery: Usually not needed for APIs unless using cookies (use ValidateAntiForgeryToken) Use authentication + authorization checks for all endpoints

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: DTOs decouple internal models from API contracts. Use AutoMapper for mapping: CreateMap&lt;Product, ProductDto&gt;(); var dto = _mapper.Map&lt;ProductDto&gt;(product);

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Avoid breaking changes to existing endpoints. Use new versions for changes in contracts. Maintain old versions as long as needed. Ensure documentation and clients are updated accordingly.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

  • Use RowVersion / ETag to detect concurrent edits.

Example with EF Core:

modelBuilder.Entity<Product>()

.Property(p => p.RowVersion).IsRowVersion();
Return 409 Conflict if concurrency exception is caught.

Model Binding & Validation

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Model binding in ASP.NET Core maps incoming HTTP data to C# parameters or model

properties.

🔍 Sources considered:

  • Route data
  • Query string
  • Form data
  • Headers
  • JSON body (application/json)
  • Uploaded files
  • Services (via [FromServices])

ASP.NET Core automatically binds data based on parameter types and attributes

([FromBody], [FromQuery], etc.).

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: SP.NET Core automatically binds data based on parameter types and attributes ([FromBody], [FromQuery], etc.).

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

  • Simple types (int, string, bool, DateTime, etc.): Bound from route, query string, or
form fields.
  • Complex types (custom classes): Bound from multiple sources like query/form fields

or JSON body.

public IActionResult Create([FromBody] Product product)
Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Use a custom model binder when default binding doesn’t work (e.g., custom formats,

headers).

public class CustomBinder : IModelBinder {
public Task BindModelAsync(ModelBindingContext context) {

// Custom logic here

}
}

Register with [ModelBinder] or globally in Startup.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

[FromQuery], etc.)

You cannot bind multiple [FromBody] parameters in a single action.

Common sources:

  • [FromBody] — for JSON/XML payloads
  • [FromQuery] — query string
  • [FromRoute] — route values
  • [FromForm] — form fields and file uploads
  • [FromHeader] — HTTP headers
Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Decorate models with attributes: public class User { [Required] [StringLength(50)] [EmailAddress] public string Email { get; set; } } Used in both MVC and API for validation.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Server-side: Always performed on the server; use ModelState.IsValid. Client-side: HTML5 + jQuery Unobtrusive Validation (for MVC/Razor Pages). Client-side validation improves UX, but server-side is essential for security.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Create custom rules by inheriting ValidationAttribute:

public class MustBeEvenAttribute : ValidationAttribute {
public override bool IsValid(object value) {
return (int)value % 2 == 0;
}
}

Use like:

[MustBeEven]

public int Number { get; set; }
Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Use for cross-field validation within a model:

public class Product : IValidatableObject {
public string Name { get; set; }
public decimal Price { get; set; }
public IEnumerable<ValidationResult> Validate(ValidationContext

context) {

if (Price < 0) {

yield return new ValidationResult("Price must be

positive");

}
}
}
Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

  • Install FluentValidation.AspNetCore
  • Create a validator class:
public class UserValidator : AbstractValidator<User> {
public UserValidator() {
RuleFor(x => x.Email).NotEmpty().EmailAddress();
}
}

Register with:

services.AddFluentValidationAutoValidation();

✅ Offers more readable and testable validation logic than data annotations.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

  • [ApiController] handles automatic validation:
  • Returns 400 BadRequest with ValidationProblemDetails if

ModelState.IsInvalid.

  • In MVC (without [ApiController]), you need to manually check

ModelState.IsValid.

if (!ModelState.IsValid) return View(model);
Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Used to check if bound model passed validation: if (!ModelState.IsValid) { return BadRequest(ModelState); } MVC automatically adds errors to ModelState based on validation attributes.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: SP.NET Core supports binding nested properties: public class Order { public Customer Customer { get; set; } public List&lt;Product&gt; Products { get; set; } } Works seamlessly from JSON or form data if property names match.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Use [Required] for non-nullable fields. For optional values, use nullable types. Use ModelState to report and handle missing/invalid fields. Return custom error messages if needed.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Model binding does not sanitize input — it binds raw data. 🛡 To prevent attacks (XSS, injection), sanitize: Strings: HTML encode output (@Html.Encode) Manually clean input before use Use antivirus/malware scanners for uploaded files

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Used for file uploads from forms (not [FromBody]):

public IActionResult Upload(IFormFile file)
{
var path = Path.Combine("uploads", file.FileName);
using var stream = new FileStream(path, FileMode.Create);

file.CopyTo(stream);

}

📝 For multiple files:

List<IFormFile> files

Configuration & AppSettings

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

  • appsettings.json: Base configuration file used across all environments.
  • appsettings.{Environment}.json: Environment-specific overrides (e.g.,

Development, Production).

🔧 ASP.NET Core loads them automatically based on the environment:

ASPNETCORE_ENVIRONMENT=Development

✅ Loaded in order of precedence, where later files override earlier ones.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: SPNETCORE_ENVIRONMENT=Development ✅ Loaded in order of precedence, where later files override earlier ones.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Production)

ASP.NET Core uses the ASPNETCORE_ENVIRONMENT variable to determine the runtime

environment.

Supported environments (by convention):

  • Development
  • Staging
  • Production

Environment-specific logic can be applied:

if (env.IsDevelopment()) { ... }

Also used to load:

  • appsettings.{env}.json
  • Startup{env}.cs (in older versions)
Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

SP.NET Core uses the ASPNETCORE_ENVIRONMENT variable to determine the runtime

environment.

Supported environments (by convention):

  • Development
  • Staging
  • Production

Environment-specific logic can be applied:

if (env.IsDevelopment()) { ... }

lso used to load:

  • appsettings.{env}.json
  • Startup{env}.cs (in older versions)
Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

✅ ASP.NET Core supports hierarchical override of config sources:

  • Environment variables override appsettings.json:

MyApp__Logging__LogLevel__Default=Warning

  • Command line arguments override everything:

dotnet run --Logging:LogLevel:Default=Debug

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Inject IConfiguration anywhere:

public class MyService {
private readonly string _apiKey;
public MyService(IConfiguration config) {
_apiKey = config["MySettings:ApiKey"];
}
}

You can also access nested settings via config.GetSection("MySettings").

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Bind config to strongly typed objects:

public class MySettings {
public string ApiKey { get; set; }
public int Timeout { get; set; }
}

services.Configure<MySettings>(config.GetSection("MySettings"));

Use via IOptions<MySettings>.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

IOptionsMonitor<T>)

  • IOptions<T>: Reads settings once at startup.
  • IOptionsSnapshot<T>: Gets updated settings per request (for scoped services).
  • IOptionsMonitor<T>: Supports change notifications and works in singleton

services.

public MyService(IOptions<MySettings> options) {
var settings = options.Value;
}
Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: User Secrets (for local dev): dotnet user-secrets init dotnet user-secrets set "MySettings:ApiKey" "secret" Azure Key Vault: builder.Configuration.AddAzureKeyVault(...); ✅ Secure sensitive data like API keys, connection strings, tokens.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

In appsettings.json:

"Logging": {

"LogLevel": {

"Default": "Information",

"Microsoft": "Warning",

"Microsoft.Hosting.Lifetime": "Information"

}
}

Supports built-in providers: Console, Debug, EventSource, Azure, etc.

Custom configuration through ILogger<T>.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Stored under "ConnectionStrings" section in appsettings.json:

"ConnectionStrings": {

"DefaultConnection":

"Server=.;Database=AppDb;Trusted_Connection=True;"
}

Read via:

var conn = config.GetConnectionString("DefaultConnection");

Or inject via Options pattern.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

JSON files support live reload:

builder.Configuration.AddJsonFile("appsettings.json", optional:

false, reloadOnChange: true);

IOptionsMonitor<T> automatically updates bound values when config changes.

🔁 Does not work with all sources (e.g., env vars, command line).

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Using POCOs and Options pattern allows type-safe config: services.Configure&lt;MySettings&gt;(config.GetSection("MySettings")); Use [Required], [Range], etc., to add validation.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

You can validate bound config using IValidateOptions<T>:

public class MySettingsValidator : IValidateOptions<MySettings> {
public ValidateOptionsResult Validate(string name, MySettings

options) {

if (string.IsNullOrWhiteSpace(options.ApiKey)) {
return ValidateOptionsResult.Fail("ApiKey is

required.");

}
return ValidateOptionsResult.Success;
}
}

Register with DI:

services.AddSingleton<IValidateOptions<MySettings>,

MySettingsValidator>();

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: SP.NET Core supports multiple configuration providers: JSON (default) Environment Variables Command Line Args INI files XML files In-memory Azure App Configuration Azure Key Vault Secrets Manager Each can be chained with priority.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

? "fallback";

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: Use default values in POCOs or fallback logic: public class MySettings { public string ApiKey { get; set; } = "default-api-key"; } Or: var apiKey = config["MySettings:ApiKey"] ?? "fallback";

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

uthentication &amp; Authorization (JWT, Identity)

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

✅ Best practices:

  • Don't log sensitive values
  • Use [JsonIgnore] or remove values before logging
  • Mask in logs manually:

_logger.LogInformation("Token: {Token}", Mask(token));

  • Never store secrets in source-controlled files (appsettings.json)
  • Use user-secrets, Key Vault, or environment variables instead

Authentication & Authorization

(JWT, Identity)

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

  • Authentication: Verifying the identity of a user (Who are you?)
  • Authorization: Determining if the authenticated user has permission to perform an

action (What are you allowed to do?)

In ASP.NET Core, both are handled via middleware and attributes like [Authorize], roles,

and policies.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: ction (What are you allowed to do?) In ASP.NET Core, both are handled via middleware and attributes like [Authorize], roles, nd policies.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

SP.NET Core Identity provides a complete solution for:

  • User registration & login
  • Roles, claims, tokens
  • Password hashing
  • Two-factor authentication

✅ Setup:

dotnet add package Microsoft.AspNetCore.Identity.EntityFrameworkCore

In Startup or Program.cs:

services.AddIdentity<IdentityUser, IdentityRole>()

.AddEntityFrameworkStores<ApplicationDbContext>()

.AddDefaultTokenProviders();

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

JWT (JSON Web Token) is a compact, URL-safe token format used for authentication.

✅ Configure JWT auth:

services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)

.AddJwtBearer(options => {

options.TokenValidationParameters = new

TokenValidationParameters {

ValidateIssuer = true,

ValidateAudience = true,

ValidateLifetime = true,

ValidateIssuerSigningKey = true,

IssuerSigningKey = new

SymmetricSecurityKey(Encoding.UTF8.GetBytes("your-secret"))

};

});

Use [Authorize] to secure endpoints.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

✅ Role-based:

[Authorize(Roles = "Admin")]

✅ Policy-based:

services.AddAuthorization(options => {

options.AddPolicy("CanEdit", policy =>

policy.RequireClaim("EditPermission"));

});

Then use:

[Authorize(Policy = "CanEdit")]

Policy-based gives more flexibility (custom requirements, claims, logic).

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

.Value;

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: dd claims when creating identity: var claims = new List&lt;Claim&gt; { new Claim(ClaimTypes.Name, user.UserName), new Claim("Permission", "Edit") }; ccess in code: var claim = User.FindFirst("Permission")?.Value;

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Used in traditional MVC apps for session-based auth.

services.AddAuthentication(CookieAuthenticationDefaults.Authenticati

onScheme)

.AddCookie(options => {

options.LoginPath = "/Account/Login";

});

On login:

await HttpContext.SignInAsync(principal);

Cookies are stored in the browser and sent with each request.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: wait HttpContext.SignInAsync(principal); Cookies are stored in the browser and sent with each request.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Use built-in providers:

services.AddAuthentication()

.AddGoogle(options => {

options.ClientId = "...";

options.ClientSecret = "...";

});

Also supports:

  • Facebook
  • Microsoft
  • Twitter
  • OpenID Connect
  • Azure AD

Use RemoteAuthenticationHandler<T> or Identity scaffolding.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: lso supports: Facebook Microsoft Twitter OpenID Connect Azure AD Use RemoteAuthenticationHandler&lt;T&gt; or Identity scaffolding.

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Used with JWT to renew access tokens after expiration without logging in again.

  • Issue refresh token along with access token.
  • Store securely (DB or secure HTTP-only cookie).
  • On access token expiration, send refresh token to get a new one.

You must manually implement refresh token logic (not built-in to Identity).

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

  • JWTs typically expire in 5–30 minutes.
  • Expired tokens cannot be used.
  • Revocation requires token blacklisting (e.g., database of revoked tokens).

✅ Configure expiration:

Expires = DateTime.UtcNow.AddMinutes(30)

✅ Use refresh tokens to handle expiration.

Permalink

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Answer: [Authorize]: Requires authenticated user [Authorize(Roles = "Admin")]: Requires role [AllowAnonymous]: Allows access without login Example: [Authorize] public IActionResult Dashboard() { } [AllowAnonymous] public IActionResult Login() { }

What interviewers expect

  • A clear definition tied to ASP.NET Core in ASP.NET Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details