Ejemplo n.º 1
0
        /// <summary>
        /// Maps a type from source property.
        /// </summary>
        /// <typeparam name="TSource">The source type being mapped.</typeparam>
        /// <typeparam name="TTarget">The target type being mapped.</typeparam>
        /// <typeparam name="TType">The source property type being mapped.</typeparam>
        /// <param name="map">The map this method works against.</param>
        /// <param name="typeMapFunc">The function used to get the result value.</param>
        /// <returns>The map this method works against.</returns>
        public static Map <TSource, TTarget> MapType <TSource, TTarget, TType>(this Map <TSource, TTarget> map, Func <object, object> typeMapFunc)
        {
            var typeMapping = new SourceTypeMapping(typeof(TType), typeMapFunc);

            map.AddMapping(typeMapping);
            return(map);
        }
Ejemplo n.º 2
0
        public void PrintNews()
        {
            //Read all the news
            var newsResultSet                  = new NewsList().GetNewsList().ToList();
            var SourceTypeMappingObj           = new SourceTypeMapping();
            var SelectPageMappingValidationObj = new SelectPageMappingValidation();


            var PageType = new PageType();

            foreach (var item in newsResultSet)
            {
                var ListOfSourceTypeId = SourceTypeMappingObj.GetSourceTypeMapping().Where(k => k.TypeOfSourceId == item.TypeOfSourceId).Select(e => e.SourceTypeMappingId);

                foreach (var item1 in ListOfSourceTypeId)
                {
                    var ListOfSourceId = SelectPageMappingValidationObj.GetselectPageMappingValidations().Where(e => e.SourceTypeMappingId == item1).ToList();

                    foreach (var item2 in ListOfSourceId)
                    {
                        var pageName = PageType.GetPageTypeById(item2.PageTypeId).Select(e => e.Name).FirstOrDefault();
                        Console.WriteLine($"{pageName}");
                        Console.WriteLine($"-------------{item.NewsContent}");
                    }
                }
            }
        }