Membru care solicită informaţii
I have a field of File Type in my Entity. How can I upload file using WCF API?
I tried to create a new Entity Member and added the following attribute in the member attributes collection
Attribute att = new Attribute();
att.Identifier = new Identifier();
att.Identifier.Name = "Image";
att.Value = bytes;
In attribute value I tried to pass the bytes array of an image, also tried Encoding.ASCII.GetString(bytes); as attribute value, but none of them works.
With byte array i get the following exception "Conversion failed when converting the nvarchar value 'System.Byte' to data type int." and in case of ASCII string i get "A database error has occurred. Contact your system administrator." error.
There is lack of documentation and samples.
Please let me know if someone tried it out.
- Editat de dotnetcoder2011 30 aprilie 2012 13:04
Thanks for the coding sample :)
But how about getting the image back out from MDS using the same API? Using the mds admin tool I see that the data has been inserted correctly, but when I do an API call to get the data back out I only get data in the "Name" field. The "Content" and "ContentType" is "null" :(
You need to use the EntityMemberAttributesGet operation to retrieve the contents of a file attribute. EntityMembersGet is designed to retrieve a collection of many members and therefore it would not make sense to retrieve every file for every row retrieved. In contrast, EntityMemberAttributesGet is designed to work with a single member and specific attributes of that member, and it was designed to retrieve the file content.
As the original creators of Microsoft MDS, Profisee's Master Data Maestro provides a range of enterprise-grade functionality to ensure MDS project success.
- Editat de Val Lovicz 14 ianuarie 2014 20:20 correction
You sound like you have a solution, but am I missing something:
In mds the file type attribute just stores the File Number. This number is the index in the mdm.tblFile where file is inside FileContent field.
So if you want to insert or extract a file you would get it from mdm.tblFile based on the index...