コード例 #1
0
ファイル: ModelMetadata.cs プロジェクト: vsimone67/KubeDeploy
                /// <summary>
                ///     Get the merge key (if any) represented by the specified model property.
                /// </summary>
                /// <typeparam name="TProperty">
                ///     The property type.
                /// </typeparam>
                /// <param name="propertyAccessExpression">
                ///     A property-access expression representing the target property.
                /// </param>
                /// <returns>
                ///     The merge key, or <c>null</c> if the property does not represent the resource's merge key.
                /// </returns>
                public static string GetMergeKey <TProperty>(Expression <Func <TModel, TProperty> > propertyAccessExpression)
                {
                    if (propertyAccessExpression == null)
                    {
                        throw new ArgumentNullException(nameof(propertyAccessExpression));
                    }

                    return(StrategicPatch.GetMergeKey(
                               GetProperty(propertyAccessExpression)
                               ));
                }
コード例 #2
0
ファイル: ModelMetadata.cs プロジェクト: vsimone67/KubeDeploy
                /// <summary>
                ///     Determine whether the specified resource field retains existing values for fields if they are not supplied in K8s strategic patch (via the $retainKeys directive).
                /// </summary>
                /// <typeparam name="TProperty">
                ///     The property type.
                /// </typeparam>
                /// <param name="propertyAccessExpression">
                ///     A property-access expression representing the target property.
                /// </param>
                /// <returns>
                ///     <c>true</c>, if existing values are retained; otherwise, <c>false</c>.
                /// </returns>
                public static bool IsRetainKeysStrategy <TProperty>(Expression <Func <TModel, TProperty> > propertyAccessExpression)
                {
                    if (propertyAccessExpression == null)
                    {
                        throw new ArgumentNullException(nameof(propertyAccessExpression));
                    }

                    return(StrategicPatch.IsRetainKeysStrategy(
                               GetProperty(propertyAccessExpression)
                               ));
                }