Ejemplo n.º 1
0
        public ObjectMapping <T> AutoMap()
        {
            IObjectMappingConvention convention = _options.GetObjectMappingConventionRegistry().Lookup <T>();

            convention.Apply(_options, this);
            return(this);
        }
Ejemplo n.º 2
0
        public ObjectMapping <T> AutoMap()
        {
            IObjectMappingConvention convention = _registry.ObjectMappingConventionRegistry.Lookup <T>();

            convention.Apply <T>(_registry, this);
            return(this);
        }
Ejemplo n.º 3
0
        private IObjectMappingConvention CreateConvention(Type type)
        {
            IObjectMappingConvention convention = _providers
                                                  .Select(provider => provider.GetConvention(type))
                                                  .FirstOrDefault(provider => provider != null);

            if (convention == null)
            {
                throw new JsonException($"No convention found for type {type.FullName}.");
            }

            return(convention);
        }
Ejemplo n.º 4
0
 public ObjectMappingConventionProvider()
 {
     _objectMappingConvention = new ObjectMappingConvention();
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Registers the convention
 /// </summary>
 /// <param name="type">The type.</param>
 /// <param name="convention">The convention.</param>
 public bool RegisterConvention(Type type, IObjectMappingConvention convention)
 {
     return(_conventions.TryAdd(type, convention));
 }