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.
파일 보기 프로젝트 열기: wkallhof/Simple301 1 사용 예제들

공개 메소드들

메소드 설명
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