Beispiel #1
0
 /// <summary>
 /// Creates a new <see cref="ValidationMessageTagHelper"/>.
 /// </summary>
 /// <param name="generator">The <see cref="IHtmlGenerator"/>.</param>
 public ValidationMessageTagHelper(IDataSetHtmlGenerator generator)
     : base(generator)
 {
 }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of <see cref="InputTagHelper"/> class.
 /// </summary>
 /// <param name="generator">The DataSet HTML generator.</param>
 public InputTagHelper(IDataSetHtmlGenerator generator)
     : base(generator)
 {
 }
Beispiel #3
0
        public static T GetTagHelper <T>(Column column, bool isScalar, DataRow dataRow, IDataSetHtmlGenerator generator, IModelMetadataProvider metadataProvider,
                                         Func <IDataSetHtmlGenerator, T> create)
            where T : DataSetTagHelperBase
        {
            if (generator == null)
            {
                generator = GetDataSetHtmlGenerator();
            }

            if (metadataProvider == null)
            {
                metadataProvider = new TestModelMetadataProvider();
            }

            var container         = column.GetContainer(isScalar);
            var containerType     = container.GetType();
            var containerMetadata = metadataProvider.GetMetadataForType(containerType);
            var containerExplorer = metadataProvider.GetModelExplorerForType(containerType, container);

            var propertyMetadata = metadataProvider.GetMetadataForProperty(containerType, nameof(container.DataSet));
            var modelExplorer    = containerExplorer.GetExplorerForExpression(propertyMetadata, container.DataSet);

            var modelExpression = new ModelExpression(nameof(container.DataSet), modelExplorer);
            var viewContext     = Factory.GetViewContext(container);
            var result          = create(generator);

            result.DataSetFor  = modelExpression;
            result.Column      = column;
            result.DataRow     = dataRow;
            result.ViewContext = viewContext;

            result.Init(new TagHelperContext(allAttributes: new TagHelperAttributeList(), items: new Dictionary <object, object>(), uniqueId: string.Empty));

            return(result);
        }
Beispiel #4
0
 /// <summary>
 /// Creates a new <see cref="SelectTagHelper"/>.
 /// </summary>
 /// <param name="generator">The <see cref="IDataSetHtmlGenerator"/>.</param>
 public SelectTagHelper(IDataSetHtmlGenerator generator)
     : base(generator)
 {
 }
 /// <summary>
 /// Intializes a new instance of <see cref="DataSetTagHelperBase"/> class.
 /// </summary>
 /// <param name="generator">The HTML generator.</param>
 protected DataSetTagHelperBase(IDataSetHtmlGenerator generator)
 {
     Generator = generator;
 }
Beispiel #6
0
 /// <summary>
 /// Creates a new instance of <see cref="TextAreaTagHelper"/>.
 /// </summary>
 /// <param name="generator">The <see cref="IDataSetHtmlGenerator"/>.</param>
 public TextAreaTagHelper(IDataSetHtmlGenerator generator)
     : base(generator)
 {
 }
Beispiel #7
0
 /// <summary>
 /// Creates a new <see cref="LabelTagHelper"/>.
 /// </summary>
 /// <param name="generator">The <see cref="IHtmlGenerator"/>.</param>
 public LabelTagHelper(IDataSetHtmlGenerator generator)
     : base(generator)
 {
 }
Beispiel #8
0
 private static TextAreaTagHelper GetTagHelper(Column column, bool isScalar = true, DataRow dataRow = null, IDataSetHtmlGenerator generator = null, IModelMetadataProvider metadataProvider = null)
 {
     return(Factory.GetTagHelper(column, isScalar, dataRow, generator, metadataProvider, g => new TextAreaTagHelper(g)));
 }