private static T Map <T>(Document source, PrismicMappingContext <T> ctx) where T : new()
        {
            var dest = new T();

            foreach (var property in ctx.DestinationMappings)
            {
                property.Value.SetValue(source, dest, property.Key, ctx);
            }

            return(dest);
        }
        private static PrismicMappingContext <T> GetContext <T>(string documentName = null) where T : new ()
        {
            var ctx = GetContextFromCache <T>(documentName);

            if (ctx != null)
            {
                return(ctx);
            }

            ctx = new PrismicMappingContext <T>(documentName);
            CacheContext(ctx);

            return(ctx);
        }
Exemple #3
0
 public void SetValue <T>(Document source, T destination, PropertyInfo property, PrismicMappingContext <T> context) where T : new()
 {
     property.SetValue(destination, GetValue(source, context.DocumentType, property));
 }
 private static void CacheContext <T>(PrismicMappingContext <T> ctx) where T : new()
 {
     _cache.Add(ctx);
 }