iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Email has been sent separately to attach the file via email to keep the confidentiality of the contents.
Attached are screen captures while running the app with multiple items with the same Display text but different Details.
Okay, considering there is a chance this.Item will not be modified but one of its related entities (e.g. this.Item.Details). In this scenario, the entities.OfType<Item>() will return null. Which means it will not enter the foreach loop, in return any chance of getting the original data from related entities is not possible. You can add the LargeImage and ThumbnailImage properties to this.Item, but these properties are useless if there aren't any changes to the entity fields. Using entities.OfType<Details>() will not return null; however, you can't use this with this.GetSingle(IEntity item) to get the original data, because the method is tied to the parent entity, which is this.Item.
Hi Arief,
Yes, we've already extended the auto-generated contoller to pick-up files from DbContext on AfterChangesDelegate. But, as I have mentioned... the db.Files property is null, even with implementation of an extended repository (as posted above). As frustating as this can be, we might be dealing with something that has not been fully implemented. If we go back to the original post, the image that we are trying to update is from a related entity (e.g. this.Item.Details.Photo). When capturing the image data from this.Item.Details.ThumbnailImage and this.Item.Details.LargeImage, the properties always return null when it's inside the foreach loop. Another issue, based on related entities, if you only modify the image from the related entity (e.g. this.Item.Details.Photo)... and did not make any changes on this.Item it will never reach the loop because the entities.OfType<Item>() returns null.
Have you tested this type of scenarios? The MyInventory sample, although worth looking into... it is quite basic and the Item entity only contains a flat table implementation, wherein the fields you need is under one table. Except of course, its category. So, if you can provide a sample that deals with complex navigation or related entities, we would very much appreciate it. Although, we can always create a workaround with saving the images using a different controller with the help of RestClient, we're very anxious to see how it should be properly implemented and that if it's actually supported at all.
Many thanks!
Okay, so here's what we did... we extended the auto-generated repository using a partial class and have overriden the InitializeSaveRequest. However, the InitializeSaveRequest method skips the call on foreach loop on save but the data is being saved. Except of course for the image files.
public class TicketMachineEditViewModel : DataEditorViewModelBase<TicketMachine, ITicketMachineRepository>
Below is the extended repository:
public partial class TicketMachineRepository { protected override void InitializeSaveRequest(RestRequest request, IEnumerable<IEntity> entities) { var p_Items = entities.OfType<TicketMachine>(); foreach (var p_Item in p_Items) { var p_OriginalItem = this.GetSingle(p_Item.TicketMachineId); var p_Machine = p_OriginalItem.Machine.MachineDetails; if (p_Machine.ThumbnailImage != null) request.AddFile("Thumbnail", p_Machine.ThumbnailImage, p_Machine.Photo, "image/jpg"); if (p_Machine.LargeImage != null) request.AddFile("Large", p_Machine.LargeImage, p_Machine.Photo, "image/jpg"); } } }
Please review and see if there's something missing. Both controller and repository files were generated using Intersoft Web API EDM Extensions.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname