Table of Contents

Class StoredProcedureBuilder

Namespace
Microsoft.EntityFrameworkCore.Metadata.Builders
Assembly
Microsoft.EntityFrameworkCore.Relational.dll

Provides a simple API for configuring a IMutableStoredProcedure that an entity type is mapped to.

public class StoredProcedureBuilder : IInfrastructure<EntityTypeBuilder>, IInfrastructure<IConventionStoredProcedureBuilder>
Inheritance
StoredProcedureBuilder
Implements
IInfrastructure<EntityTypeBuilder>
Derived
Inherited Members

Constructors

StoredProcedureBuilder(IMutableStoredProcedure, EntityTypeBuilder)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

public StoredProcedureBuilder(IMutableStoredProcedure sproc, EntityTypeBuilder entityTypeBuilder)

Parameters

sproc IMutableStoredProcedure
entityTypeBuilder EntityTypeBuilder

Properties

Builder

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

protected virtual InternalStoredProcedureBuilder Builder { get; }

Property Value

InternalStoredProcedureBuilder

Metadata

The stored procedure being configured.

public virtual IMutableStoredProcedure Metadata { get; }

Property Value

IMutableStoredProcedure

Methods

CreatePropertyBuilder(string)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

protected virtual PropertyBuilder CreatePropertyBuilder(string propertyName)

Parameters

propertyName string

Returns

PropertyBuilder

CreatePropertyBuilder<TDerivedEntity, TProperty>(Expression<Func<TDerivedEntity, TProperty>>)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

protected virtual PropertyBuilder CreatePropertyBuilder<TDerivedEntity, TProperty>(Expression<Func<TDerivedEntity, TProperty>> propertyExpression) where TDerivedEntity : class

Parameters

propertyExpression Expression<Func<TDerivedEntity, TProperty>>

Returns

PropertyBuilder

Type Parameters

TDerivedEntity
TProperty

HasAnnotation(string, object?)

Adds or updates an annotation on the stored procedure. If an annotation with the key specified in annotation already exists, its value will be updated.

public virtual StoredProcedureBuilder HasAnnotation(string annotation, object? value)

Parameters

annotation string

The key of the annotation to be added or updated.

value object

The value to be stored in the annotation.

Returns

StoredProcedureBuilder

The same builder instance so that multiple configuration calls can be chained.

HasOriginalValueParameter(string)

Configures a new parameter that holds the original value if no parameter mapped to the given property exists.

public virtual StoredProcedureBuilder HasOriginalValueParameter(string propertyName)

Parameters

propertyName string

The property name.

Returns

StoredProcedureBuilder

The same builder instance so that multiple configuration calls can be chained.

HasOriginalValueParameter(string, Action<StoredProcedureParameterBuilder>)

Configures a new parameter that holds the original value if no parameter mapped to the given property exists.

public virtual StoredProcedureBuilder HasOriginalValueParameter(string propertyName, Action<StoredProcedureParameterBuilder> buildAction)

Parameters

propertyName string

The parameter name.

buildAction Action<StoredProcedureParameterBuilder>

An action that performs configuration of the parameter.

Returns

StoredProcedureBuilder

The same builder instance so that multiple configuration calls can be chained.

HasParameter(string)

Configures a new parameter if no parameter mapped to the given property exists.

public virtual StoredProcedureBuilder HasParameter(string propertyName)

Parameters

propertyName string

The property name.

Returns

StoredProcedureBuilder

The same builder instance so that multiple configuration calls can be chained.

HasParameter(string, Action<StoredProcedureParameterBuilder>)

Configures a new parameter if no parameter mapped to the given property exists.

public virtual StoredProcedureBuilder HasParameter(string propertyName, Action<StoredProcedureParameterBuilder> buildAction)

Parameters

propertyName string

The parameter name.

buildAction Action<StoredProcedureParameterBuilder>

An action that performs configuration of the parameter.

Returns

StoredProcedureBuilder

The same builder instance so that multiple configuration calls can be chained.

HasResultColumn(string)

Configures a new column of the result for this stored procedure. This is used for database generated columns.

public virtual StoredProcedureBuilder HasResultColumn(string propertyName)

Parameters

propertyName string

The property name.

Returns

StoredProcedureBuilder

The same builder instance so that multiple configuration calls can be chained.

HasResultColumn(string, Action<StoredProcedureResultColumnBuilder>)

Configures a new column of the result for this stored procedure. This is used for database generated columns.

public virtual StoredProcedureBuilder HasResultColumn(string propertyName, Action<StoredProcedureResultColumnBuilder> buildAction)

Parameters

propertyName string

The property name.

buildAction Action<StoredProcedureResultColumnBuilder>

An action that performs configuration of the column.

Returns

StoredProcedureBuilder

The same builder instance so that multiple configuration calls can be chained.

HasRowsAffectedParameter()

Configures a new parameter that returns the rows affected if no such parameter exists.

public virtual StoredProcedureBuilder HasRowsAffectedParameter()

Returns

StoredProcedureBuilder

The same builder instance so that multiple configuration calls can be chained.

HasRowsAffectedParameter(Action<StoredProcedureParameterBuilder>)

Configures a new parameter that returns the rows affected if no such parameter exists.

public virtual StoredProcedureBuilder HasRowsAffectedParameter(Action<StoredProcedureParameterBuilder> buildAction)

Parameters

buildAction Action<StoredProcedureParameterBuilder>

An action that performs configuration of the parameter.

Returns

StoredProcedureBuilder

The same builder instance so that multiple configuration calls can be chained.

HasRowsAffectedResultColumn()

Configures a new column of the result that returns the rows affected for this stored procedure if no such column exists.

public virtual StoredProcedureBuilder HasRowsAffectedResultColumn()

Returns

StoredProcedureBuilder

The same builder instance so that multiple configuration calls can be chained.

HasRowsAffectedResultColumn(Action<StoredProcedureResultColumnBuilder>)

Configures a new column of the result that returns the rows affected for this stored procedure if no such column exists.

public virtual StoredProcedureBuilder HasRowsAffectedResultColumn(Action<StoredProcedureResultColumnBuilder> buildAction)

Parameters

buildAction Action<StoredProcedureResultColumnBuilder>

Returns

StoredProcedureBuilder

The same builder instance so that multiple configuration calls can be chained.

HasRowsAffectedReturnValue(bool)

Configures the result of this stored procedure to be the number of rows affected.

public virtual StoredProcedureBuilder HasRowsAffectedReturnValue(bool rowsAffectedReturned = true)

Parameters

rowsAffectedReturned bool

A value indicating whether this stored procedure returns the number of rows affected.

Returns

StoredProcedureBuilder

The same builder instance so that multiple configuration calls can be chained.