C# Класс 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.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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

Приватные методы

Метод Описание
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

Описание методов

AddRedirect() публичный статический Метод

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
Результат Simple301.Core.Models.Redirect

DeleteRedirect() публичный статический Метод

Handles deleting a redirect from the redirect collection
public static DeleteRedirect ( int id ) : void
id int Id of redirect to remove
Результат void

FindRedirect() публичный статический Метод

Handles finding a redirect based on the oldUrl
public static FindRedirect ( string oldUrl ) : Redirect
oldUrl string Url to search for
Результат Simple301.Core.Models.Redirect

GetAllRedirects() публичный статический Метод

Get all redirects from the repositry
public static GetAllRedirects ( ) : IEnumerable
Результат IEnumerable

GetLookupTable() публичный статический Метод

Get the lookup table for quick lookups
public static GetLookupTable ( ) : Redirect>.Dictionary
Результат Redirect>.Dictionary

UpdateRedirect() публичный статический Метод

Update a given redirect
public static UpdateRedirect ( Redirect redirect ) : Redirect
redirect Simple301.Core.Models.Redirect Redirect to update
Результат Simple301.Core.Models.Redirect