コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the ApplicationSettingsGenericStorage&lt;T&gt; class.
        /// </summary>
        /// <param name="settingsProperty">The member expression specifying application
        /// settings property to be used for storing settings object.</param>
        public ApplicationSettingsGenericStorage(
            Expression <Func <Properties.Settings, string> > settingsProperty)
        {
            Debug.Assert(settingsProperty != null);

            _storageProperty = TypeInfoProvider <Properties.Settings> .GetPropertyInfo(
                settingsProperty);
        }
コード例 #2
0
        /// <summary>
        /// Creates a new instance of the <see cref="RouteAssociationTracker"/> class.
        /// </summary>
        /// <typeparam name="TProperty">The type of the Route property to track association
        /// with.</typeparam>
        /// <param name="expression">The member expression specifying Route property to
        /// track.</param>
        /// <returns>A new instance of the <see cref="RouteAssociationTracker"/> class for the
        /// specified Route property.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="expression"/> is
        /// a null reference.</exception>
        /// <exception cref="System.ArgumentOutOfRangeException"><paramref name="expression"/> node
        /// type is not <see cref="ExpressionType.MemberAccess"/>.</exception>
        public static RouteAssociationTracker Create <TProperty>(
            Expression <Func <Route, TProperty> > expression)
        {
            CodeContract.RequiresNotNull("expression", expression);

            var propertyInfo = TypeInfoProvider <Route> .GetPropertyInfo(expression);

            return(new RouteAssociationTracker(propertyInfo));
        }
コード例 #3
0
 /// <summary>
 /// Gets name of the property specified with member expression.
 /// </summary>
 /// <typeparam name="T">The type of the property.</typeparam>
 /// <param name="expression">The member expression specifying property to get
 /// name for.</param>
 /// <returns>A name of the property.</returns>
 private static string _GetPropertyName <T>(Expression <Func <TFeatureRecord, T> > expression)
 {
     return(TypeInfoProvider <TFeatureRecord> .GetPropertyInfo(o => o.ObjectID).Name);
 }