Knight Data Access Layer
Save<T>(T) Method




KellermanSoftware.NetDataAccessLayer Namespace > ObjectCrud Class > Save Method : Save<T>(T) Method
Generic class type
An object instance
Inserts, Updates or Deletes a record in the table
Syntax
Public Overloads Function Save(Of T As {Class, New})( _
   ByVal entity As T _
) As T
Dim instance As ObjectCrud
Dim entity As T
Dim value As T
 
value = instance.Save(Of T)(entity)
public T Save<T>( 
   T entity
)
where T: class, new()
public: T* Save<T>( 
   T* entity
) 
where T: ref class, gcnew()
public:
T^ Savegeneric<typename T>
( 
   T^ entity
) 
where T: ref class, gcnew()

Parameters

entity
An object instance

Type Parameters

T
Generic class type

Return Value

The modified passed in object
Remarks
If the property IsDeleted exists and it is true, the record will be deleted. Else If the property IsNew exists and it is true or the primary key is less than or equal to 0, the record will be inserted. Else If the property IsDirty does not exist or IsDirty is true it will be updated.
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

ObjectCrud Class
ObjectCrud Members
Overload List