Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / UI / SimplePropertyEntry.cs / 1305376 / SimplePropertyEntry.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI { using System.CodeDom; using System.Web.Compilation; using Debug=System.Web.Util.Debug; ////// PropertyEntry for simple attributes /// public class SimplePropertyEntry : PropertyEntry { private string _persistedValue; private bool _useSetAttribute; private object _value; internal SimplePropertyEntry() { } ////// // public string PersistedValue { get { return _persistedValue; } set { _persistedValue = value; } } ////// public bool UseSetAttribute { get { return _useSetAttribute; } set { _useSetAttribute = value; } } ////// public object Value { get { return _value; } set { _value = value; } } // Build the statement that assigns this property internal CodeStatement GetCodeStatement(BaseTemplateCodeDomTreeGenerator generator, CodeExpression ctrlRefExpr) { // If we don't have a type, use IAttributeAccessor.SetAttribute if (UseSetAttribute) { // e.g. ((IAttributeAccessor)__ctrl).SetAttribute("{{_name}}", "{{_value}}"); CodeMethodInvokeExpression methCallExpression = new CodeMethodInvokeExpression( new CodeCastExpression(typeof(IAttributeAccessor), ctrlRefExpr), "SetAttribute"); methCallExpression.Parameters.Add(new CodePrimitiveExpression(Name)); methCallExpression.Parameters.Add(new CodePrimitiveExpression(Value)); return new CodeExpressionStatement(methCallExpression); } CodeExpression leftExpr, rightExpr = null; if (PropertyInfo != null) { leftExpr = CodeDomUtility.BuildPropertyReferenceExpression(ctrlRefExpr, Name); } else { // In case of a field, there should only be one (unlike properties) Debug.Assert(Name.IndexOf('.') < 0, "_name.IndexOf('.') < 0"); leftExpr = new CodeFieldReferenceExpression(ctrlRefExpr, Name); } if (Type == typeof(string)) { rightExpr = generator.BuildStringPropertyExpression(this); } else { rightExpr = CodeDomUtility.GenerateExpressionForValue(PropertyInfo, Value, Type); } // Now that we have both side, add the assignment return new CodeAssignStatement(leftExpr, rightExpr); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ControlCollection.cs
- SqlLiftWhereClauses.cs
- CachedCompositeFamily.cs
- EntitySqlQueryCacheKey.cs
- RadioButtonList.cs
- RequiredArgumentAttribute.cs
- ImmComposition.cs
- ActivationServices.cs
- SqlDataSource.cs
- TextSimpleMarkerProperties.cs
- WizardStepBase.cs
- RuntimeIdentifierPropertyAttribute.cs
- PreservationFileWriter.cs
- OleDbPermission.cs
- CompModSwitches.cs
- ToolStripDropDownClosedEventArgs.cs
- InkCanvasAutomationPeer.cs
- DeferredReference.cs
- XmlWriter.cs
- selecteditemcollection.cs
- HttpModuleActionCollection.cs
- FilterQueryOptionExpression.cs
- ReadOnlyHierarchicalDataSource.cs
- EmptyQuery.cs
- SchemaNames.cs
- ExternalFile.cs
- PresentationAppDomainManager.cs
- FormsAuthenticationCredentials.cs
- EntityChangedParams.cs
- MethodBody.cs
- SamlAudienceRestrictionCondition.cs
- XmlComment.cs
- TextEditorDragDrop.cs
- MultiSelectRootGridEntry.cs
- EffectiveValueEntry.cs
- TextWriter.cs
- WindowsEditBox.cs
- SecurityKeyIdentifierClause.cs
- ListParaClient.cs
- input.cs
- SchemaDeclBase.cs
- GridViewRow.cs
- TagMapCollection.cs
- JsonWriter.cs
- InteropBitmapSource.cs
- XmlSerializerAssemblyAttribute.cs
- LayoutTableCell.cs
- Win32SafeHandles.cs
- ParameterToken.cs
- Symbol.cs
- Stack.cs
- SapiAttributeParser.cs
- JoinSymbol.cs
- cookiecollection.cs
- HtmlInputText.cs
- FilterRepeater.cs
- MenuCommand.cs
- UserControl.cs
- ObjectDataSourceDesigner.cs
- InvariantComparer.cs
- AsyncDataRequest.cs
- ContextMarshalException.cs
- HttpSysSettings.cs
- CodeDirectionExpression.cs
- NameSpaceEvent.cs
- HtmlControlPersistable.cs
- Frame.cs
- MouseDevice.cs
- ToolStripControlHost.cs
- NavigationService.cs
- StreamInfo.cs
- FullTrustAssembly.cs
- OleDbException.cs
- DataGridTextBoxColumn.cs
- _HeaderInfo.cs
- SmiRequestExecutor.cs
- TextProviderWrapper.cs
- DrawingImage.cs
- Part.cs
- ParserOptions.cs
- DrawTreeNodeEventArgs.cs
- Form.cs
- SizeConverter.cs
- FixedDocumentPaginator.cs
- SamlAssertion.cs
- HtmlValidatorAdapter.cs
- CoordinationService.cs
- TextServicesCompartmentEventSink.cs
- EntityDataSourceView.cs
- IdentitySection.cs
- MailBnfHelper.cs
- HtmlShim.cs
- TextUtf8RawTextWriter.cs
- HashHelpers.cs
- TracingConnection.cs
- DataGridViewColumnTypePicker.cs
- ObjectResult.cs
- UIElementIsland.cs
- FontSizeConverter.cs
- MasterPageCodeDomTreeGenerator.cs