This is a migrated thread and some comments may be shown as answers.

Reference Counting Uploaded Files

3 Answers 66 Views
.NET SDK
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kelly
Top achievements
Rank 1
Kelly asked on 23 Feb 2014, 09:19 PM
Hello,

What is the FieldName argument in the FileField class used for, please?  The documentation doesn't mention it, as far as I have seen.  I'm uploading image files thus:

var fileField = new FileField("", info.Filename, "image/jpeg", stream);
CreateResultItem uid = _theApp.WorkWith().Files().Upload(fileField).ExecuteSync();

I don't see any difference leaving the FieldName field empty or plugging it with a dummy string.

The reason I ask, is I'm looking for a way to add a reference count to each uploaded file, so that I can delete the file after n-users have finished with it.  The Files content type doesn't allow supplementing with new fields.  I was hoping that FieldName argument might store a retrievable value somewhere...  Any ideas besides adding another intermediate content type?

Thank you,

Kelly

3 Answers, 1 is accepted

Sort by
0
Anton Dobrev
Telerik team
answered on 24 Feb 2014, 12:29 PM
Hello Kelly,

We'll take your note on the documentation under consideration and cover the parameters of this method in a more appropriate way.

The value of the 'FieldName' property is used for constructing the 'name' part of the 'Content-Disposition' header for the file upload request.

Now straight to your question: the idea to add an additional helper content type is sound and this is what we'd typically suggest.

Let us know if you have any suggestions or further questions on this matter.

Regards,
Anton Dobrev
Telerik
Everlive is now Telerik Backend Services, and is part of the Telerik Platform. For more information on the new name, and to learn more about the Platform, register for the free online keynote and webinar on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT)
0
Kelly
Top achievements
Rank 1
answered on 24 Feb 2014, 06:02 PM
Thank you, Anton, that helps.  Rather than an intermediate table, I'm considering forgetting about reference counts, and just leaving the files as danglers after all the records related to the files have been deleted from other tables, then deleting the danglers all at once.  That leads me to ask three more questions:

1) Is it possible to do the equivalent of a "join" in a TBS query?  For example, in SQL, it's easy to find records in table A whose keys either DO or DO NOT appear in related table B.  Can I do that with the TBS database, with reasonable performance?

2) What is the TBS database, anyway?  I saw a few mentions of Mondo DB in the documentation - is it a Mondo database?  I know absolutely nothing about this type of database, but I'm willing to learn if I know where to look.  Will I improve my understanding by reading about Mondo, so that I don't have to keep peppering you with questions?

3) Database cleanups like the above would be a perfect application for a scheduled job, which I read in another post, is on the drawing board.  Are scheduled jobs still in the works for TBS, and if so, do you know when?

Thanks again!

Kelly
0
Anton Dobrev
Telerik team
answered on 25 Feb 2014, 12:49 PM
Hello Kelly,

1. A usable substitute for 'join' queries is the Power Fields concept in Telerik Backend Services. You can use them client-side or within the Cloud Code. Also, we are currently developing a 'Expand for relations' feature, which is expected to be delivered soon.

2. Telerik Backend Services runs on a MongoDB database. We are trying to make our SDKs as more as comprehensive and advantageous as possible so that we do not overwhelm our customers with additional knowledge or readings. However, it would be still beneficial for our customers to possess some knowledge about the overall concepts of the document-based (NO SQL) databases, and, for example, the MongoDB operators.

Please note, that we do not currently expose the aggregation part of the MongoDB framework.

3. A scheduled jobs functionality is planned to be delivered before or around mid-2014. At this moment we cannot announce more details on this.

A possible workaround for a scheduled job is to program an external service to make a call to a certain content type in Telerik Backend Services and trigger an event hook in the Cloud Code with implemented function with the desired cleanup logic.

Let us know if any further questions arise.

Best regards,
Anton Dobrev
Telerik
Everlive is now Telerik Backend Services, and is part of the Telerik Platform. For more information on the new name, and to learn more about the Platform, register for the free online keynote and webinar on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT)
Tags
.NET SDK
Asked by
Kelly
Top achievements
Rank 1
Answers by
Anton Dobrev
Telerik team
Kelly
Top achievements
Rank 1
Share this question
or