RingSoft.DbLookup.Controls.WPF.Properties Namespace
RingSoft.DbMaintenance Namespace

ExtensionMethods..::..AddNewEntity<(Of <(<'TEntity>)>)> Method

Adds a new entity and commits the changes. Use for entities whose primary key field is not an auto-increment type. Outputs all errors to the DbDataProcessor SqlErrorViewer.

Namespace:  RingSoft.DbLookup.EfCore
Assembly:  RingSoft.DbLookup.EfCore (in RingSoft.DbLookup.EfCore.dll)

Syntax


public static bool AddNewEntity<TEntity>(
	this DbContext context,
	DbSet<TEntity> dbSet,
	TEntity entity,
	string debugMessage
)
<ExtensionAttribute> _
Public Shared Function AddNewEntity(Of TEntity) ( _
	context As DbContext, _
	dbSet As DbSet(Of TEntity), _
	entity As TEntity, _
	debugMessage As String _
) As Boolean
[ExtensionAttribute]
public:
generic<typename TEntity>
static bool^ AddNewEntity(
	DbContext^ context, 
	DbSet<TEntity>^ dbSet, 
	TEntity entity, 
	String^ debugMessage
)

Type Parameters

TEntity
The type of the entity.

Parameters

context
Type: DbContext
The context.
dbSet
Type: DbSet<(Of <(<'TEntity>)>)>
The database set.
entity
Type: TEntity
The entity.
debugMessage
Type: String
The debug message.

Return Value

True if no errors occured while saving.