0

Right now I have file upload/download through Entity Framework working but I see an issue coming up. In the scenario when i want to get a list of all the files associated with a record, I don't want it to pull the Data property, just the FileId and Name, because the files can be up to 10MB each.

I have LazyLoading disabled so I'm thinking about putting the Data column into another table and only load the data when I want. That way I can just supply a link to a controller with the FileId I want to download. But maybe there is a better way? All suggestions are appreciated. Thanks!

My File entity has the following properties:

FileId
FkRecord
Name
Data

1 Answer 1

2

you do not need to put data column in another table - just create another entity in the designer and move you [Data] column in it. don't forget to create corresponding table mapping in designer - map you data column to the column in db table.

Also create 1 to 1 association between entities. And you could use navigational properties and do not need to alter you db table!

I found similar discussion: Can I lazy load scalar properties with the ADO.Net Entity Framework?

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! This was exactly what I needed, I guess I just wasn't typing in the correct magic search phrases into SO.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.