c# - Saving each user's file along with corresponding database / table -
context: writing application in visual c# / .net, user can:
- create new document-file "untitled.abc"
- add data/content, e.g., images, text, etc.
- save document-file "mydoc7.abc", abc app-specific extension.
question: following method implement above, or there simpler/cleaner approach?
- i start sql-server database called mydb.
- each time user creates new document-file, programatically add new db table mydb
- the newly created db table stores data/content particular corresponding document-file created user.
- when user re-opens saved document-file in future, programatically read data/content attached corresponding db table.
update: solved. using alternative approach:
- i start sql-server database called mydb table called mytable, including column called fileid.
- each time user creates new document-file, assign file unique id, e.g., fileid = 5.
- when user adds piece of data/content file, store piece of data mytable, store fileid = 5 piece of data.
- in future, when user re-opens file, fetch pieces of data mytable fileid = 5.
that sounds particularly bad idea that.
- you don't want create tables on fly
- if data in database, file for?
i rather choose approach office uses:
- the file zip archive contains:
- a folder assets (images , like)
- the actual file content , relative links assets.
Comments
Post a Comment