ModelBuilder.Query Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
Query(Type, Action<QueryTypeBuilder>) |
Performs configuration of a given query type in the model. If the query type is not already part of the model, it will be added to the model. This overload allows configuration of the query type to be done in line in the method call rather than being chained after a call to Query<TQuery>(). This allows additional configuration at the model level to be chained after configuration for the query type. |
Query(Type) |
Obsolete.
Returns an object that can be used to configure a given query type in the model. If the query type is not already part of the model, it will be added to the model. |
Query(Type, Action<EntityTypeBuilder>) |
Obsolete.
Performs configuration of a given query type in the model. If the query type is not already part of the model, it will be added to the model. This overload allows configuration of the query type to be done in line in the method call rather than being chained after a call to Query<TQuery>(). This allows additional configuration at the model level to be chained after configuration for the query type. |
Query<TQuery>() |
Obsolete.
Returns an object that can be used to configure a given query type in the model. If the query type is not already part of the model, it will be added to the model. |
Query<TQuery>(Action<QueryTypeBuilder<TQuery>>) |
Obsolete.
Performs configuration of a given query type in the model. If the query type is not already part of the model, it will be added to the model. This overload allows configuration of the query type to be done in line in the method call rather than being chained after a call to Query<TQuery>(). This allows additional configuration at the model level to be chained after configuration for the query type. |
Query(Type, Action<QueryTypeBuilder>)
- Source:
- ModelBuilder.cs
- Source:
- ModelBuilder.cs
Performs configuration of a given query type in the model. If the query type is not already part of the model, it will be added to the model.
This overload allows configuration of the query type to be done in line in the method call rather than being chained after a call to Query<TQuery>(). This allows additional configuration at the model level to be chained after configuration for the query type.
public virtual Microsoft.EntityFrameworkCore.ModelBuilder Query (Type type, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.QueryTypeBuilder> buildAction);
abstract member Query : Type * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.QueryTypeBuilder> -> Microsoft.EntityFrameworkCore.ModelBuilder
override this.Query : Type * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.QueryTypeBuilder> -> Microsoft.EntityFrameworkCore.ModelBuilder
Public Overridable Function Query (type As Type, buildAction As Action(Of QueryTypeBuilder)) As ModelBuilder
Parameters
- type
- Type
The query type to be configured.
- buildAction
- Action<QueryTypeBuilder>
An action that performs configuration of the query type.
Returns
The same ModelBuilder instance so that additional configuration calls can be chained.
Applies to
Query(Type)
- Source:
- ModelBuilder.cs
- Source:
- ModelBuilder.cs
- Source:
- ModelBuilder.cs
- Source:
- ModelBuilder.cs
Caution
Use Entity(type).HasNoKey() instead
Returns an object that can be used to configure a given query type in the model. If the query type is not already part of the model, it will be added to the model.
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.QueryTypeBuilder Query (Type type);
[System.Obsolete("Use Entity(type).HasNoKey() instead")]
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder Query (Type type);
abstract member Query : Type -> Microsoft.EntityFrameworkCore.Metadata.Builders.QueryTypeBuilder
override this.Query : Type -> Microsoft.EntityFrameworkCore.Metadata.Builders.QueryTypeBuilder
[<System.Obsolete("Use Entity(type).HasNoKey() instead")>]
abstract member Query : Type -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder
override this.Query : Type -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder
Public Overridable Function Query (type As Type) As QueryTypeBuilder
Public Overridable Function Query (type As Type) As EntityTypeBuilder
Parameters
- type
- Type
The query type to be configured.
Returns
An object that can be used to configure the query type.
- Attributes
Applies to
Query(Type, Action<EntityTypeBuilder>)
- Source:
- ModelBuilder.cs
- Source:
- ModelBuilder.cs
Caution
Use Entity(type).HasNoKey() instead
Performs configuration of a given query type in the model. If the query type is not already part of the model, it will be added to the model.
This overload allows configuration of the query type to be done in line in the method call rather than being chained after a call to Query<TQuery>(). This allows additional configuration at the model level to be chained after configuration for the query type.
[System.Obsolete("Use Entity(type).HasNoKey() instead")]
public virtual Microsoft.EntityFrameworkCore.ModelBuilder Query (Type type, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder> buildAction);
[<System.Obsolete("Use Entity(type).HasNoKey() instead")>]
abstract member Query : Type * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder> -> Microsoft.EntityFrameworkCore.ModelBuilder
override this.Query : Type * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder> -> Microsoft.EntityFrameworkCore.ModelBuilder
Public Overridable Function Query (type As Type, buildAction As Action(Of EntityTypeBuilder)) As ModelBuilder
Parameters
- type
- Type
The query type to be configured.
- buildAction
- Action<EntityTypeBuilder>
An action that performs configuration of the query type.
Returns
The same ModelBuilder instance so that additional configuration calls can be chained.
- Attributes
Applies to
Query<TQuery>()
- Source:
- ModelBuilder.cs
- Source:
- ModelBuilder.cs
- Source:
- ModelBuilder.cs
- Source:
- ModelBuilder.cs
Caution
Use Entity<TEntity>().HasNoKey() instead
Returns an object that can be used to configure a given query type in the model. If the query type is not already part of the model, it will be added to the model.
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.QueryTypeBuilder<TQuery> Query<TQuery> () where TQuery : class;
[System.Obsolete("Use Entity<TEntity>().HasNoKey() instead")]
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.QueryTypeBuilder<TQuery> Query<TQuery> () where TQuery : class;
abstract member Query : unit -> Microsoft.EntityFrameworkCore.Metadata.Builders.QueryTypeBuilder<'Query (requires 'Query : null)> (requires 'Query : null)
override this.Query : unit -> Microsoft.EntityFrameworkCore.Metadata.Builders.QueryTypeBuilder<'Query (requires 'Query : null)> (requires 'Query : null)
[<System.Obsolete("Use Entity<TEntity>().HasNoKey() instead")>]
abstract member Query : unit -> Microsoft.EntityFrameworkCore.Metadata.Builders.QueryTypeBuilder<'Query (requires 'Query : null)> (requires 'Query : null)
override this.Query : unit -> Microsoft.EntityFrameworkCore.Metadata.Builders.QueryTypeBuilder<'Query (requires 'Query : null)> (requires 'Query : null)
Public Overridable Function Query(Of TQuery As Class) () As QueryTypeBuilder(Of TQuery)
Type Parameters
- TQuery
The query type to be configured.
Returns
An object that can be used to configure the query type.
- Attributes
Applies to
Query<TQuery>(Action<QueryTypeBuilder<TQuery>>)
- Source:
- ModelBuilder.cs
- Source:
- ModelBuilder.cs
- Source:
- ModelBuilder.cs
- Source:
- ModelBuilder.cs
Caution
Use Entity<TEntity>().HasNoKey() instead
Performs configuration of a given query type in the model. If the query type is not already part of the model, it will be added to the model.
This overload allows configuration of the query type to be done in line in the method call rather than being chained after a call to Query<TQuery>(). This allows additional configuration at the model level to be chained after configuration for the query type.
public virtual Microsoft.EntityFrameworkCore.ModelBuilder Query<TQuery> (Action<Microsoft.EntityFrameworkCore.Metadata.Builders.QueryTypeBuilder<TQuery>> buildAction) where TQuery : class;
[System.Obsolete("Use Entity<TEntity>().HasNoKey() instead")]
public virtual Microsoft.EntityFrameworkCore.ModelBuilder Query<TQuery> (Action<Microsoft.EntityFrameworkCore.Metadata.Builders.QueryTypeBuilder<TQuery>> buildAction) where TQuery : class;
abstract member Query : Action<Microsoft.EntityFrameworkCore.Metadata.Builders.QueryTypeBuilder<'Query>> -> Microsoft.EntityFrameworkCore.ModelBuilder (requires 'Query : null)
override this.Query : Action<Microsoft.EntityFrameworkCore.Metadata.Builders.QueryTypeBuilder<'Query>> -> Microsoft.EntityFrameworkCore.ModelBuilder (requires 'Query : null)
[<System.Obsolete("Use Entity<TEntity>().HasNoKey() instead")>]
abstract member Query : Action<Microsoft.EntityFrameworkCore.Metadata.Builders.QueryTypeBuilder<'Query>> -> Microsoft.EntityFrameworkCore.ModelBuilder (requires 'Query : null)
override this.Query : Action<Microsoft.EntityFrameworkCore.Metadata.Builders.QueryTypeBuilder<'Query>> -> Microsoft.EntityFrameworkCore.ModelBuilder (requires 'Query : null)
Public Overridable Function Query(Of TQuery As Class) (buildAction As Action(Of QueryTypeBuilder(Of TQuery))) As ModelBuilder
Type Parameters
- TQuery
The query type to be configured.
Parameters
- buildAction
- Action<QueryTypeBuilder<TQuery>>
An action that performs configuration of the query type.
Returns
The same ModelBuilder instance so that additional configuration calls can be chained.
- Attributes
Applies to
Entity Framework