在 Kendo Widget Helpers 上使用继承对性能有影响吗?
Using Inheritance on Kendo Widget Helpers has impact on performance?
我正在研究我们在项目中使用的 Kendo 小部件。我们一次又一次地使用相同的小部件,我想知道如果我们使用自定义 Html 帮助程序可以对一些属性进行分组,我们可以获得哪些好处。
我在想什么的一个例子是:
public static DropDownListBuilder MyCustomDropDownList(this HtmlHelper helper, Models.Specialty model, string dataCascadeFunction)
{
ResourceService resource = new ResourceService();
return helper.Kendo().DropDownList()
.DataTextField("Name")
.DataValueField("Id")
.OptionLabel("Select Specialty")
.Events(evt => evt.Open("clearFilterOnDdl"))
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetCascadeSpecialties", "AcAdmin")
.Data(dataCascadeFunction)
.Type(HttpVerbs.Get);
})
.ServerFiltering(true);
})
.Filter("contains")
.MinLength(3)
.Text(model != null ? model.Name?? string.Empty : string.Empty)
.Value(model != null ? model.Id ?? string.Empty : string.Empty);
}
然后我这样从我的角度调用它
@(Html.MyCustomDropDownList(Model.Specialty, "filterSpecialties")
.CascadeFrom("OperationType_Id")
.Name("Specialty.Id")
)
我所做的只是设置一些默认的自定义设置,以节省一些代码行并使我的代码更清晰。我想知道 Html 助手的这种使用对我的项目的性能有什么好的或坏的影响。
重用 Kendo UI HtmlHelpers 的默认自定义设置的演示方法是有效的,不会对性能产生影响。
我正在研究我们在项目中使用的 Kendo 小部件。我们一次又一次地使用相同的小部件,我想知道如果我们使用自定义 Html 帮助程序可以对一些属性进行分组,我们可以获得哪些好处。 我在想什么的一个例子是:
public static DropDownListBuilder MyCustomDropDownList(this HtmlHelper helper, Models.Specialty model, string dataCascadeFunction)
{
ResourceService resource = new ResourceService();
return helper.Kendo().DropDownList()
.DataTextField("Name")
.DataValueField("Id")
.OptionLabel("Select Specialty")
.Events(evt => evt.Open("clearFilterOnDdl"))
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetCascadeSpecialties", "AcAdmin")
.Data(dataCascadeFunction)
.Type(HttpVerbs.Get);
})
.ServerFiltering(true);
})
.Filter("contains")
.MinLength(3)
.Text(model != null ? model.Name?? string.Empty : string.Empty)
.Value(model != null ? model.Id ?? string.Empty : string.Empty);
}
然后我这样从我的角度调用它
@(Html.MyCustomDropDownList(Model.Specialty, "filterSpecialties")
.CascadeFrom("OperationType_Id")
.Name("Specialty.Id")
)
我所做的只是设置一些默认的自定义设置,以节省一些代码行并使我的代码更清晰。我想知道 Html 助手的这种使用对我的项目的性能有什么好的或坏的影响。
重用 Kendo UI HtmlHelpers 的默认自定义设置的演示方法是有效的,不会对性能产生影响。