Marks a persistent object for deletion.
Syntax
| Visual Basic (Declaration) | |
|---|
Public Sub MarkForDeletion( _
ByVal obj As Object _
) |
| Visual Basic (Usage) | Copy Code |
|---|
Dim instance As ObjectContext
Dim obj As Object
instance.MarkForDeletion(obj)
|
| C# | |
|---|
public void MarkForDeletion(
object obj
) |
| Managed Extensions for C++ | |
|---|
public: void MarkForDeletion(
Object* obj
) |
| C++/CLI | |
|---|
public:
void MarkForDeletion(
Object^ obj
) |
Parameters
- obj
- Persistent object that is marked for deletion.
Example
The following example shows you how delete an object from the storage.
| C# | Copy Code |
|---|
// Creates a new ObjectContext that uses an MsSql Server as storage. ObjectContext context = new ObjectContext(new MsSqlStorage("sa", "", "localhost", "application")); // ... Other code. // Get the first user matching the name. User user = context.GetObject<User>("Name like {0}", "%mith%"); // Mark the object for deletion. context.MarkForDeletion(user); // Deletes the user object from the storage. context.PersistChanges(user); |
Remarks
Requirements
Platforms: Windows 2000, Windows XP family, Windows Server 2003 family, Windows Vista family
See Also