DbContext.Set Method
Assembly: EntityFramework (in EntityFramework.dll)
| Name | Description | |
|---|---|---|
![]() | Set(Type) | Returns a non-generic DbSet instance for access to entities of the given type in the context and the underlying store. |
![]() | Set<'TEntity>() | Returns a DbSet<'TEntity> instance for access to entities of the given type in the context and the underlying store. |
DbContext.Set Method (Type)
Returns a non-generic DbSet instance for access to entities of the given type in the context and the underlying store.
[<SuppressMessageAttribute("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Set")>] abstract Set : entityType:Type -> DbSet [<SuppressMessageAttribute("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Set")>] override Set : entityType:Type -> DbSet
Parameters
- entityType
-
Type:
System.Type
The type of entity for which a set should be returned.
Note that Entity Framework requires that this method return the same instance each time that it is called for a given context instance and entity type. Also, the generic DbSet<'TEntity> returned by the Set method must wrap the same underlying query and set of entities. These invariants must be maintained if this method is overridden for anything other than creating test doubles for unit testing. See the DbSet class for more details.
DbContext.Set<'TEntity> Method ()
Returns a DbSet<'TEntity> instance for access to entities of the given type in the context and the underlying store.
[<SuppressMessageAttribute("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Set")>] abstract Set<'TEntity when 'TEntity : not struct> : unit -> DbSet<'TEntity> [<SuppressMessageAttribute("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Set")>] override Set<'TEntity when 'TEntity : not struct> : unit -> DbSet<'TEntity>
Type Parameters
- TEntity
The type entity for which a set should be returned.
Note that Entity Framework requires that this method return the same instance each time that it is called for a given context instance and entity type. Also, the non-generic DbSet returned by the Set method must wrap the same underlying query and set of entities. These invariants must be maintained if this method is overridden for anything other than creating test doubles for unit testing. See the DbSet<'TEntity> class for more details.
