NET Link Tracker
DeleteLink Method (LinkLogic)
Example 



KellermanSoftware.NetLinkTracker Namespace > LinkLogic Class : DeleteLink Method
The link to delete
Delete a tracked link
Syntax
'Declaration
 
Public Sub DeleteLink( _
   ByVal trackedLink As TrackedLink _
) 
'Usage
 
Dim instance As LinkLogic
Dim trackedLink As TrackedLink
 
instance.DeleteLink(trackedLink)
public void DeleteLink( 
   TrackedLink trackedLink
)
public:
void DeleteLink( 
   TrackedLink^ trackedLink
) 

Parameters

trackedLink
The link to delete
Example
LinkLogic linkLogic = new LinkLogic(); //Trial Mode
LinkLogic linkLogicLicensed = new LinkLogic("place user name here", "place license key here");  //License Mode
 
//Use a in memory mock database for testing
ILinkTrackerDatabaseLogic databaseLogic = new LinkTrackerMockDatabase();
 
linkLogic.DatabaseLogic = databaseLogic;
 
//Create a link to a URL that will expire in 30 days
TrackedLink createdLink = linkLogic.CreateExpiringUrl("http://www.google.com", 30);
 
TrackedLink link = linkLogic.GetLinkByGuid(createdLink.LinkGuid);
LinkStatus status = linkLogic.CheckLinkStatus(link);
 
//The status will be Active
Console.WriteLine("Status: " + status);
 
//Get a friendly status for the user
Console.WriteLine("Friendly Status: " + linkLogic.GetFriendlyStatus(link));
 
//Delete the link, even though it is not expired
databaseLogic.DeleteLink(link);
 
//This will be zero
Console.WriteLine("Number of links: " + linkLogic.DatabaseLogic.GetAllTrackedLinks().Count);
Dim linkLogic As New LinkLogic() 'Trial Mode
Dim linkLogicLicensed As New LinkLogic("place user name here", "place license key here") 'License Mode
 
'Use a in memory mock database for testing
Dim databaseLogic As ILinkTrackerDatabaseLogic = New LinkTrackerMockDatabase()
 
linkLogic.DatabaseLogic = databaseLogic
 
'Create a link to a URL that will expire in 30 days
Dim createdLink As TrackedLink = linkLogic.CreateExpiringUrl("http://www.google.com", 30)
 
Dim link As TrackedLink = linkLogic.GetLinkByGuid(createdLink.LinkGuid)
Dim status As LinkStatus = linkLogic.CheckLinkStatus(link)
 
'The status will be Active
Console.WriteLine("Status: " & status)
 
'Get a friendly status for the user
Console.WriteLine("Friendly Status: " & linkLogic.GetFriendlyStatus(link))
 
'Delete the link, even though it is not expired
databaseLogic.DeleteLink(link)
 
'This will be zero
Console.WriteLine("Number of links: " & linkLogic.DatabaseLogic.GetAllTrackedLinks().Count)
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

LinkLogic Class
LinkLogic Members