Пример #1
0
 /// <summary>
 /// Adds the css builder services to the specified <see cref="IServiceCollection"/>.
 /// </summary>
 /// <param name="serviceCollection">
 /// The <see cref="IServiceCollection"/> to add services to.
 /// </param>
 /// <param name="action">
 /// An <see cref="Action{CssBuilderOptions}"/>  to configure the provided <see cref="CssBuilderOptions"/>.
 /// </param>
 public static void AddCssBuilder(
     this IServiceCollection serviceCollection,
     Action <CssBuilderOptions> action = null)
 {
     serviceCollection.TryAddSingleton <ICssBuilder, CssBuilder>();
     serviceCollection.AddSingleton(p =>
     {
         var options = new CssBuilderOptions();
         action?.Invoke(options);
         return(options);
     });
 }
Пример #2
0
        internal CssClassList(CssBuilderOptions options)
        {
            _cssClasses = new List <string>();
            _options    = options ?? throw new ArgumentNullException(nameof(options));
            if (_options.EnumToClassNameConverter == null)
            {
                throw new ArgumentException("Options.EnumToClassNameConverter can't be null.");
            }

            if (_options.PropertyToClassNameConverter == null)
            {
                throw new ArgumentException("Options.PropertyToClassNameConverter can't be null.");
            }

            _cache = options.GetCache();
        }
Пример #3
0
 private CssClassList CreateCssDefinition(CssBuilderOptions options = null)
 {
     return(cssBuilder.Create(options));
 }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CssBuilder"/> class.
 /// </summary>
 /// <param name="options">An options object which modifies class name generation and other things.</param>
 public CssBuilder(CssBuilderOptions options)
 {
     _options = options;
 }