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
- _DigestClient.cs
- TrustLevel.cs
- compensatingcollection.cs
- TextBreakpoint.cs
- SymbolType.cs
- UnauthorizedAccessException.cs
- SqlClientWrapperSmiStreamChars.cs
- ImportCatalogPart.cs
- DataViewManagerListItemTypeDescriptor.cs
- XmlElement.cs
- FormsAuthentication.cs
- WebResourceAttribute.cs
- FullTextBreakpoint.cs
- IDataContractSurrogate.cs
- SymmetricKeyWrap.cs
- UIElementIsland.cs
- PipeStream.cs
- Serializer.cs
- SerializationAttributes.cs
- ManipulationLogic.cs
- GenericUI.cs
- ContentOperations.cs
- TraceUtils.cs
- Lease.cs
- Model3D.cs
- ProgressBar.cs
- BitmapCacheBrush.cs
- ToolStripDropDownItem.cs
- IdentitySection.cs
- SqlHelper.cs
- Double.cs
- GeometryModel3D.cs
- ObjectCache.cs
- CodeValidator.cs
- IItemProperties.cs
- SystemBrushes.cs
- PeerDuplexChannel.cs
- MetadataPropertyCollection.cs
- CodeGotoStatement.cs
- TaiwanCalendar.cs
- _Events.cs
- GeometryHitTestParameters.cs
- FlowDocumentReaderAutomationPeer.cs
- BreakSafeBase.cs
- UpDownEvent.cs
- Input.cs
- TdsParser.cs
- MenuBindingsEditorForm.cs
- MediaPlayerState.cs
- ReadWriteObjectLock.cs
- DataGridViewUtilities.cs
- DataGrid.cs
- DataGridTextBox.cs
- LockRenewalTask.cs
- CodeDirectiveCollection.cs
- StrongNamePublicKeyBlob.cs
- RadialGradientBrush.cs
- TextClipboardData.cs
- SafeSecurityHandles.cs
- _CommandStream.cs
- Logging.cs
- Query.cs
- TableLayoutStyle.cs
- ScriptIgnoreAttribute.cs
- RequestQueryProcessor.cs
- IntPtr.cs
- BindingSource.cs
- ProcessMessagesAsyncResult.cs
- InstallerTypeAttribute.cs
- ToolZone.cs
- CanExecuteRoutedEventArgs.cs
- DataGridColumnHeadersPresenterAutomationPeer.cs
- LoginCancelEventArgs.cs
- CancelAsyncOperationRequest.cs
- SimpleHandlerFactory.cs
- WindowsFormsHostPropertyMap.cs
- BoundsDrawingContextWalker.cs
- UIElementHelper.cs
- EntityDesignerDataSourceView.cs
- ComponentDispatcherThread.cs
- DataRowExtensions.cs
- TCEAdapterGenerator.cs
- ValidationResult.cs
- FormsAuthenticationUserCollection.cs
- GridViewColumnCollection.cs
- EventProxy.cs
- DbConnectionPool.cs
- BrowserCapabilitiesCodeGenerator.cs
- ContainerParaClient.cs
- CodeLabeledStatement.cs
- GeneralTransform3DGroup.cs
- IISUnsafeMethods.cs
- LinqTreeNodeEvaluator.cs
- OutputScopeManager.cs
- DependencyPropertyValueSerializer.cs
- Literal.cs
- PrimitiveSchema.cs
- RawTextInputReport.cs
- HuffCodec.cs
- RegistrySecurity.cs