Exemple #1
0
        public bool Matches(PropertyName name)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            bool matchesParameters = IndexParameters.Zip(name.IndexParameters,
                                                         (t, u) => t.Matches(u)).AllTrue();

            return(name.Name == this.Name &&
                   TypeName.SafeMatch(this.DeclaringType, name.DeclaringType) &&
                   matchesParameters);
        }
Exemple #2
0
        private void AppendIndexParameters(Dictionary <string, string> parameters, IndexParameters indexParameters)
        {
            if (!indexParameters.Timeout.IsNullOrEmpty())
            {
                parameters.Add("timeout", indexParameters.Timeout);
            }

            if (!indexParameters.TTL.IsNullOrEmpty())
            {
                parameters.Add("ttl", indexParameters.TTL);
            }

            if (indexParameters.VersionType != VersionType.Internal)             //internal == default
            {
                parameters.Add("version_type", indexParameters.VersionType.ToString().ToLower());
            }
        }
Exemple #3
0
        private List <string> AppendIndexParameters(List <string> parameters, IndexParameters indexParameters)
        {
            if (indexParameters == null)
            {
                return(parameters);
            }

            if (!indexParameters.Timeout.IsNullOrEmpty())
            {
                parameters.Add("timeout=" + indexParameters.Timeout);
            }

            if (indexParameters.VersionType != VersionType.Internal)             //internal == default
            {
                parameters.Add("version_type=" + indexParameters.VersionType.ToString().ToLower());
            }

            return(parameters);
        }
        // TODO FS: Test for explicit interface implementation
        public IMethodEmitter CreateSetMethod()
        {
            if (SetMethod != null)
            {
                throw new InvalidOperationException("This property already has a setter method.");
            }
            else
            {
                MethodAttributes flags = MethodAttributes.Public | MethodAttributes.SpecialName;
                if (PropertyKind == PropertyKind.Static)
                {
                    flags |= MethodAttributes.Static;
                }

                Type[] setterParameterTypes = new Type[IndexParameters.Length + 1];
                IndexParameters.CopyTo(setterParameterTypes, 0);
                setterParameterTypes[IndexParameters.Length] = PropertyType;

                IMethodEmitter method = _declaringType.CreateMethod(BuildAccessorMethodName(Name, "set"), flags, typeof(void), setterParameterTypes);

                SetMethod = method;
                return(method);
            }
        }
Exemple #5
0
 public PostIndexRequest()
 {
     State = new IndexParameters();
 }