﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - Crosslight - How to Use Crosslight to Save Images via EntityContextProvider</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-to-Save-Images-via-EntityContextProvider/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>How to Use Crosslight to Save Images via EntityContextProvider</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-to-Save-Images-via-EntityContextProvider/</link><pubDate>Mon, 13 Apr 2015 10:06:27 GMT</pubDate><dc:creator>Arief</dc:creator><description>&lt;p style="font-size: 13.3333330154419px;"&gt;Hi Jimmy,&lt;br&gt;&lt;br&gt;Sorry for super late response, there is actually 2 solutions for your cases, i will also explain the reasoning behind the problems.&lt;br&gt;&lt;br&gt;Solutions 1:&lt;br&gt;&lt;span style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif; -webkit-font-smoothing: antialiased; margin: 0px; padding: 0px; border: 0px; outline-offset: 0px; color: rgb(51, 51, 51); font-size: 13px; line-height: 19.5px; text-rendering: optimizelegibility !important; background-color: rgb(255, 255, 255);"&gt;if using&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif; -webkit-font-smoothing: antialiased; margin: 0px; padding: 0px; border: 0px; outline-offset: 0px; color: rgb(51, 51, 51); font-size: 13px; line-height: 19.5px; font-weight: bold; text-rendering: optimizelegibility !important; background-color: rgb(255, 255, 255);"&gt;entities.OfType&amp;lt;Item&amp;gt;()&lt;/span&gt;&lt;span style="color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif; font-size: 13px; line-height: 19.5px; background-color: rgb(255, 255, 255);"&gt;&amp;nbsp;&lt;/span&gt;&lt;br&gt;&lt;br&gt;You can still use that but we need to add this inside your :&lt;br&gt;&lt;/p&gt;&lt;pre style="-webkit-font-smoothing: antialiased; margin-top: 0px; margin-bottom: 0px; padding: 0px; border: 0px; outline-offset: 0px; white-space: pre-wrap; word-wrap: break-word; color: rgb(63, 63, 63); line-height: 18px; text-rendering: optimizelegibility !important;"&gt;this.Item.&lt;span style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif; -webkit-font-smoothing: antialiased; margin: 0px; padding: 0px; border: 0px; outline-offset: 0px; font-weight: bold; text-rendering: optimizelegibility !important;"&gt;Details&lt;/span&gt;.Photo = Guid.NewGuid().ToString("n") + ".jpg";&lt;/pre&gt;&lt;pre style="-webkit-font-smoothing: antialiased; margin-top: 0px; margin-bottom: 0px; padding: 0px; border: 0px; outline-offset: 0px; white-space: pre-wrap; word-wrap: break-word; color: rgb(63, 63, 63); line-height: 18px; text-rendering: optimizelegibility !important;"&gt;this.Item.&lt;span style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif; -webkit-font-smoothing: antialiased; margin: 0px; padding: 0px; border: 0px; outline-offset: 0px; font-weight: bold; text-rendering: optimizelegibility !important;"&gt;Details&lt;/span&gt;.ThumbnailImage = imagePicker.Result.ThumbnailImageData;&lt;/pre&gt;&lt;pre style="-webkit-font-smoothing: antialiased; margin-top: 0px; margin-bottom: 0px; padding: 0px; border: 0px; outline-offset: 0px; white-space: pre-wrap; word-wrap: break-word; color: rgb(63, 63, 63); line-height: 18px; text-rendering: optimizelegibility !important;"&gt;this.Item.&lt;span style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif; -webkit-font-smoothing: antialiased; margin: 0px; padding: 0px; border: 0px; outline-offset: 0px; font-weight: bold; text-rendering: optimizelegibility !important;"&gt;Details&lt;/span&gt;.LargeImage = imagePicker.Result.ImageData;&lt;/pre&gt;&lt;pre style="-webkit-font-smoothing: antialiased; margin-top: 0px; margin-bottom: 0px; padding: 0px; border: 0px; outline-offset: 0px; white-space: pre-wrap; word-wrap: break-word; color: rgb(63, 63, 63); line-height: 18px; text-rendering: optimizelegibility !important;"&gt;&lt;br&gt;&lt;/pre&gt;&lt;pre style="-webkit-font-smoothing: antialiased; margin-top: 0px; margin-bottom: 0px; padding: 0px; border: 0px; outline-offset: 0px; white-space: pre-wrap; word-wrap: break-word; color: rgb(63, 63, 63); line-height: 18px; text-rendering: optimizelegibility !important;"&gt;//Add this&lt;/pre&gt;&lt;pre style="-webkit-font-smoothing: antialiased; margin-top: 0px; margin-bottom: 0px; padding: 0px; border: 0px; outline-offset: 0px; word-wrap: break-word; text-rendering: optimizelegibility !important;"&gt;&lt;font color="#3f3f3f"&gt;&lt;span style="line-height: 18px; white-space: pre-wrap;"&gt;this.Item.EntityAspect.EntityState = EntityState.Modified;&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;&lt;p style="font-size: 13.3333330154419px;"&gt;&lt;br&gt;When you use details it actually only send what changed so only details that sent, and because what you send in the form of details it doesn't accepted in entities of type&amp;lt;Item&amp;gt;, so in my solutions i make them send both items (by set it state modified) and details using entity state&amp;nbsp;&lt;br&gt;&lt;br&gt;Solutions 2:&lt;br&gt;&lt;span style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif; -webkit-font-smoothing: antialiased; margin: 0px; padding: 0px; border: 0px; outline-offset: 0px; color: rgb(51, 51, 51); font-size: 13px; line-height: 19.5px; text-rendering: optimizelegibility !important; background-color: rgb(255, 255, 255);"&gt;if using&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif; -webkit-font-smoothing: antialiased; margin: 0px; padding: 0px; border: 0px; outline-offset: 0px; color: rgb(51, 51, 51); font-size: 13px; line-height: 19.5px; font-weight: bold; text-rendering: optimizelegibility !important; background-color: rgb(255, 255, 255);"&gt;entities.OfType&amp;lt;Details&amp;gt;()&lt;/span&gt;&lt;span style="color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif; font-size: 13px; line-height: 19.5px; background-color: rgb(255, 255, 255);"&gt;&amp;nbsp;&lt;/span&gt;&lt;br&gt;&lt;br&gt;You actually can use get single inside your intialize save request but you need Inject Repository/Entity that you want for example you want GetSingle from MachineDetails just add this:&lt;br&gt;&lt;/p&gt;&lt;pre&gt;private IMachineDetailsRepository MachineDetailsRepository        {            get            {
                if (Container.Current.CanResolve&amp;lt;I&lt;span style="font-size: 9pt;"&gt;MachineDetails&lt;/span&gt;&lt;span style="font-size: 9pt;"&gt;Repository&amp;gt;())&lt;/span&gt;&lt;br&gt;                    return Container.Current.Resolve&amp;lt;I&lt;span style="font-size: 9pt;"&gt;MachineDetails&lt;/span&gt;&lt;span style="font-size: 9pt;"&gt;Repository&amp;gt;();&lt;/span&gt;&lt;br&gt;                else
					return new &lt;span style="font-size: 9pt;"&gt;MachineDetails&lt;/span&gt;&lt;span style="font-size: 9pt;"&gt;Repository(null); // design time support&lt;/span&gt;&lt;br&gt;            }
        }&lt;/pre&gt;&lt;p style="font-size: 13.3333330154419px;"&gt;&amp;nbsp;then you can use it inside you IntializeSaveRequest:&lt;/p&gt;&lt;pre&gt; public partial class TicketMachineRepository
    {
        protected override void InitializeSaveRequest(RestRequest request, IEnumerable&amp;lt;IEntity&amp;gt; entities)
        {
            var p_Items = entities.OfType&amp;lt;MachineDetails&amp;gt;();

            foreach (var p_Item in p_Items)
            {
                var p_OriginalItem = &lt;b&gt;MachineDetailRepository&lt;/b&gt;.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");
            }
        }
    }&lt;/pre&gt;&lt;p style="font-size: 13.3333330154419px;"&gt;Yep the getSingle actually obtained from parent entity e.g. TicketMachineRepository but you can actually inject the repository using code above so you can obtain GetSIngle from other entity, GetSIngle is function from repository (EntityRepository).&lt;br&gt;&lt;/p&gt;&lt;p style="font-size: 13.3333330154419px;"&gt;&lt;br&gt;Hope that helps and sorry again this take a long time to be solved&lt;br&gt;&lt;br&gt;Best Regards&lt;br&gt;Arief&lt;/p&gt;</description></item><item><title>How to Use Crosslight to Save Images via EntityContextProvider</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-to-Save-Images-via-EntityContextProvider/</link><pubDate>Fri, 27 Mar 2015 10:08:42 GMT</pubDate><dc:creator>Arief</dc:creator><description>&lt;p&gt;Hi Jimmy&lt;br&gt;&lt;br&gt;Sorry for the late respond, currently i still investigating this issue i will give you update regarding this issue, in the mean time i guess you should use your own workaround, sorry.&lt;br&gt;&lt;br&gt;Best Regards,&lt;br&gt;Arief&lt;/p&gt;</description></item><item><title>How to Use Crosslight to Save Images via EntityContextProvider</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-to-Save-Images-via-EntityContextProvider/</link><pubDate>Mon, 23 Mar 2015 21:35:46 GMT</pubDate><dc:creator>jtungol@silentpartnersoft.com</dc:creator><description>&lt;p&gt;Okay, considering there is a chance &lt;span style="font-weight: bold;"&gt;this.Item&lt;/span&gt; will not be modified but one of its related entities (e.g. this.Item.Details). In this scenario, the &lt;span style="font-weight: bold;"&gt;entities.OfType&amp;lt;Item&amp;gt;()&lt;/span&gt; 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 &lt;span style="font-weight: bold;"&gt;entities.OfType&amp;lt;Details&amp;gt;()&lt;/span&gt; will not return null; however, you can't use this with &lt;span style="font-weight: bold;"&gt;this.GetSingle(IEntity item)&lt;/span&gt; to get the original data, because the method is tied to the parent entity, which is this.Item.&lt;/p&gt;Now,
 in order to solve this scenario... we have to modify one of Item's 
fields (e.g. ModifiedDate or something similar) programatically, before 
DataEditorViewModelBase.ExecuteSave() is called. This workaround tells 
the framework that something has changed to the Item, eventually adding 
it to the list of entities where the original data can be retrieved 
within &lt;span style="font-weight: bold;"&gt;InitializeSaveRequest&lt;/span&gt;.</description></item><item><title>How to Use Crosslight to Save Images via EntityContextProvider</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-to-Save-Images-via-EntityContextProvider/</link><pubDate>Mon, 23 Mar 2015 07:37:47 GMT</pubDate><dc:creator>Arief</dc:creator><description>&lt;p&gt;Hi Jimmy,&lt;br&gt;Sorry for late response,&lt;br&gt;&lt;br&gt;I see, i will try to create related entities in edmx, also can i see your models .cs file.&amp;nbsp;&lt;span style="font-size: 13.3333330154419px;"&gt;My plan is i will create new entities name imagedetail and connected to the item, the byte will be in the imagedetail&lt;/span&gt;&lt;br&gt;&lt;br&gt;Also could you (its ok if you couldn't) temporarily add this to your project:&amp;nbsp;&lt;a href="http://git.intersoftpt.com/projects/CROS/repos/frameworks/browse/Intersoft.AppFramework" target="_blank"&gt;http://git.intersoftpt.com/projects/CROS/repos/frameworks/browse/Intersoft.AppFramework&lt;/a&gt;&amp;nbsp;then:&amp;nbsp;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;remove references Intersoft.AppFramework change the reference with this project&lt;/li&gt;&lt;li&gt;open you .cs file that contain&amp;nbsp;InitializeSaveRequest and&amp;nbsp;entities.OfType&lt;/li&gt;&lt;li&gt;press the references and double click the&amp;nbsp;this.InitializeSaveRequest(request, entities);&lt;br&gt;&lt;/li&gt;&lt;li&gt;please check this line of code&amp;nbsp;IEnumerable&amp;lt;IEntity&amp;gt; entities = this.EntityContainer.PrepareSavedEntities();, does the program return entities?&lt;/li&gt;&lt;/ul&gt;Is the code working (&lt;span style="color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif; font-size: 13px; line-height: 19.5px; background-color: rgb(255, 255, 255);"&gt;entities.OfType&amp;lt;Item&amp;gt;()&lt;/span&gt;) when it put inside simple entities?&lt;br&gt;&lt;br&gt;I guess our crux of problem now lies in entities.OfType because the data actually inputable to database except the file&lt;br&gt;&lt;br&gt;Best Regards&lt;br&gt;Arief&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br style="font-size: 10pt;"&gt;&lt;br style="font-size: 10pt;"&gt;&lt;p&gt;&lt;/p&gt;</description></item><item><title>How to Use Crosslight to Save Images via EntityContextProvider</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-to-Save-Images-via-EntityContextProvider/</link><pubDate>Thu, 19 Mar 2015 12:06:47 GMT</pubDate><dc:creator>jtungol@silentpartnersoft.com</dc:creator><description>&lt;p&gt;Hi Arief,&lt;/p&gt;&lt;p&gt;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&amp;lt;Item&amp;gt;() returns null.&lt;/p&gt;&lt;p&gt;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.&lt;/p&gt;&lt;p&gt;Many thanks!&lt;/p&gt;</description></item><item><title>How to Use Crosslight to Save Images via EntityContextProvider</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-to-Save-Images-via-EntityContextProvider/</link><pubDate>Thu, 19 Mar 2015 06:31:22 GMT</pubDate><dc:creator>Arief</dc:creator><description>&lt;p&gt;Hi Jimmy,&lt;br&gt;&lt;br&gt;You actually need to call the method but it is actually useable because already generated by EDMX to inherit the&amp;nbsp;EditableEntityRepository in the repository (if you peek this you can see InitializeSaveRequest). &amp;nbsp;So the bottom line is, it is built-in but user can choose whether want to use it or not.&lt;br&gt;&lt;br&gt;Based from what i know repository generated from EDMX shouldn't expected to be changed, especially if you change the EDMX properties which means it can change repository dynamically and remove change that you made in that repository, so it is better to extend repository. I think it is also true for each files autogenerated from edmx.&lt;br&gt;&lt;br&gt;Did it show any error code when you save the data? I think your extended repository already right.&lt;/p&gt;&lt;p&gt;You also need to extend from DomainModels\InventoryModel.Controller.cs generated from edmx into web.API controller using this code:&lt;/p&gt;&lt;pre&gt;using System;using System.Collections.Generic;using System.IO;using System.Linq;using System.Web;using MyInventory.DomainModels;namespace MyInventory.DomainModels.Controllers
{
    partial class InventoryController
    {
        public InventoryController()
        {
            db.AfterSaveChangesDelegate = (context, affectedRows) =&amp;gt;
                {
                    if (affectedRows &amp;gt; 0)
                    {
                        string imagePath = HttpContext.Current.Server.MapPath("~/images");

                        if (db.Files != null &amp;amp;&amp;amp; db.Files.Count() &amp;gt; 0)
                        {
                            foreach (var file in db.Files)
                            {
                                file.Save(Path.Combine(imagePath, file.Name == "Thumbnail" ? "thumbs" : "large"));
                            }
                        }
                    }
                };
        }
    }
}&lt;/pre&gt;&lt;p&gt;&amp;nbsp;This code is for saving the file into web&lt;br&gt;&lt;br&gt;Hope that solve the problems :)&lt;br&gt;&lt;br&gt;Best Regards&lt;br&gt;Arief&lt;/p&gt;</description></item><item><title>How to Use Crosslight to Save Images via EntityContextProvider</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-to-Save-Images-via-EntityContextProvider/</link><pubDate>Wed, 18 Mar 2015 13:42:56 GMT</pubDate><dc:creator>jtungol@silentpartnersoft.com</dc:creator><description>&lt;p&gt;Okay, so here's what we did... we extended the auto-generated repository using a partial class and have overriden the &lt;strong&gt;InitializeSaveRequest&lt;/strong&gt;. However, the &lt;strong&gt;InitializeSaveRequest&lt;/strong&gt; method skips the call on foreach loop on save &lt;strong&gt;but&lt;/strong&gt; the data is being saved. Except of course for the image files.&lt;/p&gt;&lt;pre&gt;    public class TicketMachineEditViewModel : DataEditorViewModelBase&amp;lt;TicketMachine, ITicketMachineRepository&amp;gt;&lt;/pre&gt;
&lt;p&gt;Below is the extended repository:&lt;/p&gt;

&lt;pre&gt;    public partial class TicketMachineRepository
    {
        protected override void InitializeSaveRequest(RestRequest request, IEnumerable&amp;lt;IEntity&amp;gt; entities)
        {
            var p_Items = entities.OfType&amp;lt;TicketMachine&amp;gt;();

            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");
            }
        }
    }
&lt;/pre&gt;

&lt;p&gt;Please review and see if there's something missing. Both controller and repository files were generated using Intersoft Web API EDM Extensions.&lt;/p&gt;</description></item><item><title>How to Use Crosslight to Save Images via EntityContextProvider</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-to-Save-Images-via-EntityContextProvider/</link><pubDate>Wed, 18 Mar 2015 10:02:44 GMT</pubDate><dc:creator>jtungol@silentpartnersoft.com</dc:creator><description>So, you're telling me that the generated repository from the EDMX file is not sufficient? And that the code above is not built in, even with MultiPart enabled? What I want to understand is why I need to extend the repository in this manner with the understanding that this feature is already built in. Please advise if my assumption is wrong and that the code above must be implemented. If your answer is that it should be implemented, please consider the codes posted on the next reply. I have attached a screenshot of the EDMX configuration that you might find interesting.&lt;br&gt;&lt;br&gt;As always, many thanks!&lt;br&gt;</description></item><item><title>How to Use Crosslight to Save Images via EntityContextProvider</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-to-Save-Images-via-EntityContextProvider/</link><pubDate>Wed, 18 Mar 2015 07:25:38 GMT</pubDate><dc:creator>Arief</dc:creator><description>&lt;p style="font-size: 13.3333330154419px;"&gt;Also i forgot to tell you need also changes in ItemRepository.cs:&lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;pre&gt;protected override void InitializeSaveRequest(RestRequest request, IEnumerable&amp;lt;IEntity&amp;gt; entities)		{
			var items = entities.OfType&amp;lt;Item&amp;gt;();

			// send the new images (both thumbnail and large) along with the save request

			foreach (var item in items)
			{
				var originalItem = this.GetSingle(item.ItemID);

				if (originalItem.ImageDetail.ThumbnailImage != null)
                    request.AddFile("Thumbnail", originalItem.ImageDetail.ThumbnailImage, item.Image, "image/jpg");

				if (originalItem.ImageDetail.LargeImage != null)
                    request.AddFile("Large", originalItem.ImageDetail.LargeImage, item.Image, "image/jpg");
			}
		}&lt;/pre&gt;&lt;p style="font-size: 13.3333330154419px;"&gt;&amp;nbsp;Which is rather crucial for image uploading&lt;/p&gt;</description></item><item><title>How to Use Crosslight to Save Images via EntityContextProvider</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-to-Save-Images-via-EntityContextProvider/</link><pubDate>Wed, 18 Mar 2015 03:32:23 GMT</pubDate><dc:creator>Arief</dc:creator><description>&lt;p&gt;Hi Jimmy,&lt;br&gt;&lt;br&gt;I made a sample and i'm successfully upload image to File, you should check it out. I also use similar structure of your model and i also already try it in IOS and Android.&lt;br&gt;&lt;br&gt;Here is the link sorry for using mediafire:&amp;nbsp;&lt;a href="http://www.mediafire.com/download/nnks8ymrn924djj/MyInventory_WebApi.zip" target="_blank"&gt;http://www.mediafire.com/download/nnks8ymrn924djj/MyInventory_WebApi.zip&lt;/a&gt;&lt;br&gt;&lt;br&gt;I only change these files:&lt;br&gt;myinventory.core\domainmodels\item.cs&lt;br&gt;MyInventory.Core\ViewModels\ItemEditorViewModel.cs&lt;br&gt;myinventory.core\models\item.formmetadata.cs&lt;br&gt;myinventory.core\bindingproviders\itemdetailbindingprovider.cs&lt;br&gt;&lt;br&gt;My samples based on MyInventoryAPI&lt;br&gt;&lt;br&gt;Based from what i found, previously i can't upload image which return error with HTML code then I use multiparts which solve the error but other than that i can upload file successfully (file appear in my webAPI folder and saved in database).&lt;br&gt;&lt;br&gt;I suspect maybe there are something wrong with your EDMX configurations&lt;br&gt;&lt;br&gt;If you may please send us your samples&lt;br&gt;&lt;br&gt;Best Regards,&lt;br&gt;Arief&lt;br&gt;&lt;/p&gt;</description></item><item><title>How to Use Crosslight to Save Images via EntityContextProvider</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-to-Save-Images-via-EntityContextProvider/</link><pubDate>Sat, 14 Mar 2015 02:56:06 GMT</pubDate><dc:creator>jtungol@silentpartnersoft.com</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;How are images being sent via EntityContextProvider? Based on the MyInventory_WebApi sample, there are four (4) properties added to a partial class that extends the Item within the core project for the mobile platforms. Two of these properties contain the actual data of type byte[] and two are string properties resolving the Url for large and thumbnail image files. We've implemented the same set of properties in order to add/edit/delete an image for a selected record via form editor; however, the image files are not being saved on the disk. Although, the image path is being saved on the database the byte[] data for the LargeImage and ThumbnailImage properties are not being sent to the server. We've confirmed this by debugging the partial class for the Web Api Controller, and noticed that the EntityContextProvider.Files collection is null.&lt;/p&gt;

&lt;p&gt;That being the case, please note that the Image we're trying to modify is coming from a related entity and NOT from the Item itself. Here's a code snippet to show you how things are being done from the core. The following codes assigns the new file name for the &lt;strong&gt;Photo&lt;/strong&gt;, while &lt;strong&gt;ThumbnailImage&lt;/strong&gt; and &lt;strong&gt;LargeImage&lt;/strong&gt; contain the sets of byte[]. While the file name is being saved to the database successfully, the contents of the byte[] are not being sent to the server.&lt;/p&gt;

&lt;pre&gt;this.Item.&lt;span style="font-weight: bold;"&gt;Details&lt;/span&gt;.Photo = Guid.NewGuid().ToString("n") + ".jpg";
this.Item.&lt;span style="font-weight: bold;"&gt;Details&lt;/span&gt;.ThumbnailImage = imagePicker.Result.ThumbnailImageData;
this.Item.&lt;span style="font-weight: bold;"&gt;Details&lt;/span&gt;.LargeImage = imagePicker.Result.ImageData;&lt;/pre&gt;

&lt;p&gt;We even tried creating the resolving properties on the same class with that of the Item, resulting to the code below, but still not working.&lt;/p&gt;

&lt;pre&gt;this.Item.&lt;span style="font-weight: bold;"&gt;Details&lt;/span&gt;.Photo = Guid.NewGuid().ToString("n") + ".jpg";
this.Item.ThumbnailImage = imagePicker.Result.ThumbnailImageData;
this.Item.LargeImage = imagePicker.Result.ImageData;&lt;/pre&gt;

&lt;p&gt;Is there anything else we need to do here, aside from creating just the properties and assigning the results? Please advise.&lt;br&gt;&lt;/p&gt;</description></item></channel></rss>