C# Class Simple301.Core.RedirectRepository

Redirect Repository that handles CRUD operations for the repository collection Utilizes Umbraco Database context to persist redirects into the database but utilizes an in-memory collection for fast querying.
Afficher le fichier Open project: wkallhof/Simple301 Class Usage Examples

Méthodes publiques

Méthode Description
AddRedirect ( bool isRegex, string oldUrl, string newUrl, string notes ) : Redirect

Add a new redirect to the redirects collection

DeleteRedirect ( int id ) : void

Handles deleting a redirect from the redirect collection

FindRedirect ( string oldUrl ) : Redirect

Handles finding a redirect based on the oldUrl

GetAllRedirects ( ) : IEnumerable

Get all redirects from the repositry

GetLookupTable ( ) : Redirect>.Dictionary

Get the lookup table for quick lookups

UpdateRedirect ( Redirect redirect ) : Redirect

Update a given redirect

Private Methods

Méthode Description
DetectLoop ( string oldUrl, string newUrl ) : bool

Detects a loop in the redirects list given the new redirect. Uses Floyd's cycle-finding algorithm.

FetchRedirectById ( int id ) : Redirect

Fetches a single redirect from the DB based on an Id

FetchRedirectsFromDb ( ) : Redirect>.Dictionary

Fetches all redirects from the database

RedirectRepository ( ) : System

Method Details

AddRedirect() public static méthode

Add a new redirect to the redirects collection
public static AddRedirect ( bool isRegex, string oldUrl, string newUrl, string notes ) : Redirect
isRegex bool
oldUrl string Old Url to redirect from
newUrl string New Url to redirect to
notes string Any associated notes with this redirect
Résultat Simple301.Core.Models.Redirect

DeleteRedirect() public static méthode

Handles deleting a redirect from the redirect collection
public static DeleteRedirect ( int id ) : void
id int Id of redirect to remove
Résultat void

FindRedirect() public static méthode

Handles finding a redirect based on the oldUrl
public static FindRedirect ( string oldUrl ) : Redirect
oldUrl string Url to search for
Résultat Simple301.Core.Models.Redirect

GetAllRedirects() public static méthode

Get all redirects from the repositry
public static GetAllRedirects ( ) : IEnumerable
Résultat IEnumerable

GetLookupTable() public static méthode

Get the lookup table for quick lookups
public static GetLookupTable ( ) : Redirect>.Dictionary
Résultat Redirect>.Dictionary

UpdateRedirect() public static méthode

Update a given redirect
public static UpdateRedirect ( Redirect redirect ) : Redirect
redirect Simple301.Core.Models.Redirect Redirect to update
Résultat Simple301.Core.Models.Redirect