本文整理匯總了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