Class EntityExtensions
public static class EntityExtensions
- Inheritance
-
EntityExtensions
- Inherited Members
Methods
Clone<T>(T)
Create an instance of the entity in a new context with the same principal
public static T Clone<T>(this T source) where T : IEntity
Parameters
sourceT
Returns
- T
Type Parameters
T
Clone<T>(T, IEntityContext)
Create a new instance or overwrite an existing instance of the entity in a different context
public static T Clone<T>(this T source, IEntityContext context) where T : IEntity
Parameters
sourceTcontextIEntityContext
Returns
- T
Type Parameters
T
Copy<T>(T)
Create a new entity which is a shallow copy of the original in the same context
public static T Copy<T>(this T source) where T : IEntity
Parameters
sourceT
Returns
- T
Type Parameters
T
Copy<T>(T, IEntityContext)
Create a new entity which is a shallow copy of the original in a different context
public static T Copy<T>(this T source, IEntityContext context) where T : IEntity
Parameters
sourceTcontextIEntityContext
Returns
- T
Type Parameters
T
Delete(IEntity)
Mark the entity for deletion when next saved, which will only succeed if its relationships have been unset first.
[Obsolete("Non-async delete is deprecated because it tends to leave entities in an unsaveable state.")]
public static void Delete(this IEntity source)
Parameters
sourceIEntity
DeleteAndCascadeAsLoaded(IEntity)
Deletes an entity as well as its owned (Value) entities, removing it from unowned (Lookup) relationships.
public static void DeleteAndCascadeAsLoaded(this IEntity source)
Parameters
sourceIEntity
Exceptions
- InvalidOperationException
Thrown when a relationship in the graph being deleted is not loaded.
DeleteAndCascadeAsync(IEntity, CancellationToken?)
deletes an entity as well as its owned (Value) entities, removing it from unowned (Lookup) relationships
public static Task DeleteAndCascadeAsync(this IEntity source, CancellationToken? cancellationToken = null)
Parameters
sourceIEntitycancellationTokenCancellationToken?
Returns
DeleteAndPruneAsync(IEntity, CancellationToken?)
Mark the entity for deletion when next saved, removing it from all relationships first
public static Task DeleteAndPruneAsync(this IEntity source, CancellationToken? cancellationToken = null)
Parameters
sourceIEntitycancellationTokenCancellationToken?
Returns
SaveAsync(IEntity, CancellationToken?)
Save the entity
public static Task<SaveResult> SaveAsync(this IEntity source, CancellationToken? cancellationToken = null)
Parameters
sourceIEntitycancellationTokenCancellationToken?