예제 #1
0
        private RootObjectMapping CreateMapFor(Type t, string type, int maxRecursion = 0)
        {
            var writer      = new TypeMappingWriter(t, type, this.Settings, maxRecursion);
            var typeMapping = writer.RootObjectMappingFromAttributes();

            return(typeMapping);
        }
예제 #2
0
        /// <summary>
        /// Convenience method to map from most of the object from the attributes/properties.
        /// Later calls on the fluent interface can override whatever is set is by this call.
        /// This helps mapping all the ints as ints, floats as floats etcetera withouth having to be overly verbose in your fluent mapping
        /// </summary>
        /// <returns></returns>
        public NestedObjectMappingDescriptor <TParent, TChild> MapFromAttributes(int maxRecursion = 0)
        {
            var writer  = new TypeMappingWriter(typeof(TChild), this._TypeName, this._connectionSettings, maxRecursion);
            var mapping = writer.NestedObjectMappingFromAttributes();

            if (mapping == null)
            {
                return(this);
            }
            if (this._Mapping.Properties == null)
            {
                this._Mapping.Properties = new Dictionary <string, IElasticType>();
            }

            var properties = mapping.Properties;

            foreach (var p in properties)
            {
                this._Mapping.Properties[p.Key] = p.Value;
            }
            return(this);
        }
        /// <summary>
        /// Convenience method to map from most of the object from the attributes/properties.
        /// Later calls on the fluent interface can override whatever is set is by this call.
        /// This helps mapping all the ints as ints, floats as floats etcetera withouth having to be overly verbose in your fluent mapping
        /// </summary>
        /// <returns></returns>
        public PutMappingDescriptor <T> MapFromAttributes(int maxRecursion = 0)
        {
            var writer  = new TypeMappingWriter(typeof(T), this._Type, this._connectionSettings, maxRecursion);
            var mapping = writer.RootObjectMappingFromAttributes();

            if (mapping == null)
            {
                return(this);
            }
            var properties = mapping.Properties;

            if (this._Mapping.Properties == null)
            {
                this._Mapping.Properties = new Dictionary <PropertyNameMarker, IElasticType>();
            }

            foreach (var p in properties)
            {
                this._Mapping.Properties[p.Key] = p.Value;
            }
            return(this);
        }
        /// <summary>
        /// Convenience method to map from most of the object from the attributes/properties.
        /// Later calls can override whatever is set is by this call.
        /// This helps mapping all the ints as ints, floats as floats etcetera withouth having to be overly verbose in your fluent mapping
        /// </summary>
        /// <returns></returns>
        public PutMappingDescriptor <T> MapFromAttributes(int maxRecursion = 0)
        {
            //TODO no longer needed when we have an IPutMappingRequest
            var writer  = new TypeMappingWriter(typeof(T), Self.Type, this._connectionSettings, maxRecursion);
            var mapping = writer.RootObjectMappingFromAttributes();

            if (mapping == null)
            {
                return(this);
            }
            var properties = mapping.Properties;

            if (Self.Mapping.Properties == null)
            {
                Self.Mapping.Properties = new Dictionary <PropertyNameMarker, IElasticType>();
            }

            foreach (var p in properties)
            {
                Self.Mapping.Properties[p.Key] = p.Value;
            }
            return(this);
        }
예제 #5
0
        private string CreateMapFor <T>(string type) where T : class
        {
            var writer = new TypeMappingWriter <T>(type, PropertyNameResolver);

            return(writer.MapFromAttributes());
        }
예제 #6
0
        private string CreateMapFor(Type t, string type, int maxRecursion = 0)
        {
            var writer = new TypeMappingWriter(t, type, maxRecursion);

            return(writer.MapFromAttributes());
        }