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); }
/// <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); }