IQueryBuilder.RemoveWhere<TModel>() Method
.NET Standard 2.x
(Obsolete) Removes all the conditions from the WHERE clause.
Namespace: SnapObjects.Data
Assembly: SnapObjects.Data.dll
Syntax
public IQueryWhereBuilder<TModel> RemoveWhere()
Type Parameters
TModel
The type of a model class.
Returns
SnapObjects.Data.IQueryWhereBuilder<TModel>
Returns a newly created IQueryWhereBuilder<TModel>
object.
Remark
RemoveWhere
method is deprecated, please use ISqlModelMapper.GetQueryBuilder<TModel>(true) instead.
Examples
The following code example demonstrates how to use the RemoveWhere
method.
using Appeon.ApiDoc.Models.School;
using System;
namespace Appeon.ApiDoc.IQueryBuilderExamples
{
public class RemoveWhereExample
{
private SchoolContext _context;
public RemoveWhereExample(SchoolContext dataContext)
{
// Sets Data Context
_context = dataContext;
}
public async void Example()
{
// Get a QueryBuilder object.
var Builder = _context.SqlModelMapper.GetQueryBuilder<DepartmentByName>();
var result = (await Builder.LoadAsync("Engineering")).ToList();
Console.WriteLine("Before remove WHERE clause: ");
foreach (var dept in result)
{
Console.WriteLine(dept.Name);
}
// Remove the WHERE clause.
Builder.RemoveWhere();
result = (await Builder.LoadAsync("Engineering")).ToList();
Console.WriteLine();
Console.WriteLine("After remove WHERE clause: ");
foreach (var dept in result)
{
Console.WriteLine(dept.Name);
}
}
/*This code produces the following output:
Before remove WHERE clause:
Engineering
After remove WHERE clause:
Engineering
English
Economics
Mathematics
New Department
*/
}
}
Example Refer To
Model Class: DepartmentByName
Applies to
.NET Standard
2.x