SqlDeleteBuilder.SqlDeleteBuilder(string name = "") Constructor
.NET Standard 2.x
Initializes a new instance of the SqlDeleteBuilder class.
Namespace: SnapObjects.Data
Assembly: SnapObjects.Data.dll
Syntax
public SqlDeleteBuilder(string name = "");
Parameters
name
System.String
(Optional) The name for this SqlDeleteBuilder object.
Examples
The following code example demonstrates how to create a SqlDeleteBuilder object.
using SnapObjects.Data;
using System;
namespace Appeon.ApiDoc.SqlDeleteBuilderExamples
{
public class SqlDeleteBuilderExample
{
private readonly SchoolContext _context;
public SqlDeleteBuilderExample(SchoolContext dataContext)
{
// Sets data context
_context = dataContext;
}
public void Example()
{
// Creates a SqlDeleteBuilder object.
ISqlDeleteBuilder delete = new SqlDeleteBuilder();
// Uses this object to build the DELETE statement.
delete.Delete("Course");
delete.Where("courseid", SqlBuilder.Parameter<int>("id"));
// Outputs the generated SQL statement.
var sql = delete.ToSqlString(_context);
Console.WriteLine(sql);
/*This code produces the following output:
DELETE
FROM [Course]
WHERE ([courseid] = @id)
*/
}
}
}
Applies to
.NET Standard
2.x