private static IUrlGenerator GetUrlGenerator(BulletinBoardOptions options) { if (options.UrlGenerator != null) { return(options.UrlGenerator); } return(options.Storage.DefaultUrlGenerator( new UrlGenerationOptions( options.Name, options.PresignedUrls, options.PresignedUrlExpires))); }
public BulletinOptionsBuilder AddBoard(BulletinBoardOptions options) { if (_boardOptions.ContainsKey(options.Name)) { throw new ArgumentException($"Board with name `{options.Name}` already registered."); } if (!IsValidName(options.Name)) { throw new ArgumentException($"Bulletin board name must be url-path safe, got {options.Name}"); } _boardOptions.Add(options.Name, options); return(this); }
public BulletinBoard(IBulletinDbContext dbContext, BulletinBoardOptions options) { _options = options; _dbContext = dbContext; _urlGenerator = GetUrlGenerator(_options); }