A very strange event happened in my project, I have fairly simple CLR objects. The first one is Model other ViewModel , after I compile the project, I started the WebApi ASP.NET project with the required parameters, I see that my Model returns data.
As soon as I see that Mapper did the mapping in order and the second time it returns every thing with zeros. A problem that does not always occur.
Very important: update 03/14/2013
This stops doing this when I recycle the application, but after a while it starts to do it again, I save the web.config again then ok again.
Here is my model / ViewModel:
public class Gallery : Entity { public override long Id { get; set; } public virtual Settings SiteOwner { get; set; } public virtual Category Category { get; set; } public virtual string PageTitle { get; set; } public virtual string TitleDescription { get; set; } public virtual string GalleryTitle { get; set; } public virtual IList<UIItem> GalleryItems { get; set; } } public class UIItem : Entity { public override long Id { get; set; } public virtual Product Product { get; set; } public virtual Gallery Gallery { get; set; } public virtual string Name { get; set; } public virtual string Description { get; set; } public virtual string Price { get; set; } public virtual string ImageUrl { get; set; } public virtual string VideoUrl { get; set; } public virtual string FileUrl { get; set; } } public class GalleryViewModel { public virtual string PageTitle { get; set; } public virtual string TitleDescription { get; set; } public virtual string GalleryTitle { get; set; } public virtual IList<UIItemViewModel> GalleryItems { get; set; } } public class UIItemViewModel { public virtual long Id { get; set; } public virtual string Name { get; set; } public virtual string Description { get; set; } public virtual string Price { get; set; } public virtual string ImageUrl { get; set; } public virtual string VideoUrl { get; set; } public virtual string FileUrl { get; set; } }
This is how i use it
// my apicontroller // FindGalleryByAppIdAndCategoryId returns => Gallery var source = _galleryRepository.FindGalleryByAppIdAndCategoryId(appId, catId); return Mapper.DynamicMap<GalleryViewModel>(source);
source share