本文整理汇总了C#中System.Web.UI.ControlBuilder.EnsureEntriesSorted方法的典型用法代码示例。如果您正苦于以下问题:C# ControlBuilder.EnsureEntriesSorted方法的具体用法?C# ControlBuilder.EnsureEntriesSorted怎么用?C# ControlBuilder.EnsureEntriesSorted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.ControlBuilder
的用法示例。
在下文中一共展示了ControlBuilder.EnsureEntriesSorted方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildBuildMethod
/*
* Build the data tree for a control's build method
*/
protected CodeMemberMethod BuildBuildMethod(ControlBuilder builder, bool fTemplate,
bool fInTemplate, bool topLevelControlInTemplate, PropertyEntry pse, bool fControlSkin) {
Debug.Assert(builder.ServiceProvider == null);
ServiceContainer container = new ServiceContainer();
container.AddService(typeof(IFilterResolutionService), HttpCapabilitiesBase.EmptyHttpCapabilitiesBase);
try {
builder.SetServiceProvider(container);
builder.EnsureEntriesSorted();
}
finally {
builder.SetServiceProvider(null);
}
string methodName = GetMethodNameForBuilder(buildMethodPrefix, builder);
Type ctrlType = GetCtrlTypeForBuilder(builder, fTemplate);
bool fStandardControl = false;
bool fControlFieldDeclared = false;
CodeMemberMethod method = new CodeMemberMethod();
AddDebuggerNonUserCodeAttribute(method);
method.Name = methodName;
method.Attributes = MemberAttributes.Private | MemberAttributes.Final;
_sourceDataClass.Members.Add(method);
// If it's for a template or a r/o complex prop, pass a parameter of the control's type
ComplexPropertyEntry cpse = pse as ComplexPropertyEntry;
if (fTemplate || (cpse != null && cpse.ReadOnly)) {
if (builder is RootBuilder)
method.Parameters.Add(new CodeParameterDeclarationExpression(_sourceDataClass.Name, "__ctrl"));
else
method.Parameters.Add(new CodeParameterDeclarationExpression(ctrlType, "__ctrl"));
}
else {
// If it's a standard control, return it from the method
if (typeof(Control).IsAssignableFrom(builder.ControlType)) {
fStandardControl = true;
}
Debug.Assert(builder.ControlType != null);
if (builder.ControlType != null) {
if (fControlSkin) {
// ReturnType needs to be of type Control in a skin file to match
// the controlskin delegate.
if (fStandardControl) {
method.ReturnType = new CodeTypeReference(typeof(Control));
}
}
else {
PartialCachingAttribute cacheAttrib = (PartialCachingAttribute)
TypeDescriptor.GetAttributes(builder.ControlType)[typeof(PartialCachingAttribute)];
if (cacheAttrib != null) {
method.ReturnType = new CodeTypeReference(typeof(Control));
}
else {
// Otherwise the return type is always the actual component type.
method.ReturnType = CodeDomUtility.BuildGlobalCodeTypeReference(builder.ControlType);
}
}
}
// A control field declaration is required, this field will be returned
// in the method.
fControlFieldDeclared = true;
}
// Add a control parameter if it's a ControlSkin
if (fControlSkin) {
method.Parameters.Add(new CodeParameterDeclarationExpression(typeof(Control).FullName, "ctrl"));
}
BuildBuildMethodInternal(builder, builder.ControlType, fInTemplate, topLevelControlInTemplate, pse,
method.Statements, fStandardControl, fControlFieldDeclared, null, fControlSkin);
return method;
}
示例2: BuildBuildMethod
protected CodeMemberMethod BuildBuildMethod(ControlBuilder builder, bool fTemplate, bool fInTemplate, bool topLevelControlInTemplate, PropertyEntry pse, bool fControlSkin)
{
ServiceContainer serviceProvider = new ServiceContainer();
serviceProvider.AddService(typeof(IFilterResolutionService), HttpCapabilitiesBase.EmptyHttpCapabilitiesBase);
try
{
builder.SetServiceProvider(serviceProvider);
builder.EnsureEntriesSorted();
}
finally
{
builder.SetServiceProvider(null);
}
string methodNameForBuilder = this.GetMethodNameForBuilder(buildMethodPrefix, builder);
Type ctrlTypeForBuilder = this.GetCtrlTypeForBuilder(builder, fTemplate);
bool fStandardControl = false;
bool fControlFieldDeclared = false;
CodeMemberMethod method = new CodeMemberMethod();
base.AddDebuggerNonUserCodeAttribute(method);
method.Name = methodNameForBuilder;
method.Attributes = MemberAttributes.Private | MemberAttributes.Final;
base._sourceDataClass.Members.Add(method);
ComplexPropertyEntry entry = pse as ComplexPropertyEntry;
if (fTemplate || ((entry != null) && entry.ReadOnly))
{
if (builder is RootBuilder)
{
method.Parameters.Add(new CodeParameterDeclarationExpression(base._sourceDataClass.Name, "__ctrl"));
}
else
{
method.Parameters.Add(new CodeParameterDeclarationExpression(ctrlTypeForBuilder, "__ctrl"));
}
}
else
{
if (typeof(Control).IsAssignableFrom(builder.ControlType))
{
fStandardControl = true;
}
if (builder.ControlType != null)
{
if (fControlSkin)
{
if (fStandardControl)
{
method.ReturnType = new CodeTypeReference(typeof(Control));
}
}
else if (((PartialCachingAttribute) TypeDescriptor.GetAttributes(builder.ControlType)[typeof(PartialCachingAttribute)]) != null)
{
method.ReturnType = new CodeTypeReference(typeof(Control));
}
else
{
method.ReturnType = CodeDomUtility.BuildGlobalCodeTypeReference(builder.ControlType);
}
}
fControlFieldDeclared = true;
}
if (fControlSkin)
{
method.Parameters.Add(new CodeParameterDeclarationExpression(typeof(Control).FullName, "ctrl"));
}
this.BuildBuildMethodInternal(builder, builder.ControlType, fInTemplate, topLevelControlInTemplate, pse, method.Statements, fStandardControl, fControlFieldDeclared, null, fControlSkin);
return method;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:67,代码来源:BaseTemplateCodeDomTreeGenerator.cs