// Example 1: Using named parameters var query = session.CreateQuery("FROM Order o WHERE o.CustomerName = :name"); query.SetParameter("name", "John Doe"); // Example 2: Using positional parameters var query = session.CreateQuery("FROM Employee e WHERE e.LastName = ?"); query.SetParameter(0, "Doe"); // Example 3: Using array parameters var ids = new[] { 1, 2, 3 }; var query = session.CreateQuery("FROM Product p WHERE p.Id IN (:ids)"); query.SetParameterList("ids", ids); // Example 4: Using a dictionary of parameters var parameters = new DictionaryThe NHibernate.Engine.QueryParameters class is part of the NHibernate package, which is available on NuGet.() { { "startDate", new DateTime(2021, 1, 1) }, { "endDate", new DateTime(2021, 12, 31) } }; var query = session.CreateQuery("FROM Order o WHERE o.OrderDate BETWEEN :startDate AND :endDate"); query.SetProperties(parameters);