MyObject.Delete

MyObject.Delete

Old forum URL: forums.lhotka.net/forums/t/4716.aspx


SouthSpawn posted on Friday, April 18, 2008

I am doing something like this.
 
MyCompany = Company.GetCompany(Id)
 
This is fetching the company information just fine.
 
Now, when I do a "MyCompany.Delete()"
 
It doesn't fire any of the DataPortal_Delete Methods.

I am using the 3.5 Version of CSLA.

Any suggestions?

Thanks,
mark

Marjon1 replied on Saturday, April 19, 2008

Mark,

Your Company.GetCompany(Id) method would have a call to DataPortal.Fetch within it, this is responsible for doing the call to the DataPortal_Fetch methods.

When you have an object and call MyCompany.Delete(), all it does is set an internal IsDeleted flag to true, you would then need to call MyCompany.Save() to have the DataPortal_DeleteSelf method fire.

Depending on your use cases, it's not abnormal to have a Company.DeleteCompany(Id) method which calls the DataPortal_Delete method. That way you don't have to fetch the object first to delete it.

Marjon

sergeyb replied on Saturday, April 19, 2008

You also need to call Save().  This should fire DataPortal_DeleteSelf, if I follow you situation correctly.

 

Sergey Barskiy

Senior Consultant

office: 678.405.0687 | mobile: 404.388.1899

cid:_2_0648EA840648E85C001BBCB886257279
Microsoft Worldwide Partner of the Year | Custom Development Solutions, Technical Innovation

 

From: SouthSpawn [mailto:cslanet@lhotka.net]
Sent: Friday, April 18, 2008 10:52 PM
To: Sergey Barskiy
Subject: [CSLA .NET] MyObject.Delete

 

I am doing something like this.

 

MyCompany = Company.GetCompany(Id)

 

This is fetching the company information just fine.

 

Now, when I do a "MyCompany.Delete()"

 

It doesn't fire any of the DataPortal_Delete Methods.

I am using the 3.5 Version of CSLA.


Any suggestions?

Thanks,
mark



Copyright (c) Marimer LLC