All pages are almost the same while with different articles, so I made them base on a template.
Now I need to load the fiction into the page. I have two ideas to achieve this.
One is by storing it in the database. However, each fiction has a large and different letter count. It seems not well to store it in the database.
The other is by storing it in a .Txt file, then load and cache it. Whereas, I don't know how to set the.Txt file to private(not allow download the .Txt file by any other people).
I am not sure which of my idea is right. Or there is a better solution. Would you please give me a suggestion? Thank you.
You can store the fiction into a database, if it's a long fiction,You can store them in chapters.For example, fiction model can have fictionId,
fictionnames. And fiction model can be bound to chapters for easy management and query.
If it is a short story, you can save it as txt, but make sure that the format inside is correct.
I recommend using the database method, although the design is complicated but it will be easy to manage.
Best Regards,
Jerry Cai
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
I am sorry I don't know what is the plaintext truly means. It seems it is an HTML element that has been abandon.
The article I need to store just like this:
<h1>Harry Potter</h1>
<article>Harry Potter is a series of seven fantasy novels written by British author J. K. Rowling. The novels chronicle the lives of a young wizard, Harry Potter, and his friends Hermione Granger and Ron Weasley, all of whom are students at Hogwarts School
of Witchcraft and Wizardry. The main story arc concerns Harry's struggle against Lord Voldemort, a dark wizard who intends to become immortal, overthrow the wizard governing body known as the Ministry of Magic and subjugate all wizards and Muggles (non-magical
people).</article>
Member
53 Points
246 Posts
How should I load article by asp.net core?
Nov 05, 2020 02:06 AM|mywatermelon|LINK
I am making a website of fiction by asp.net core.
All pages are almost the same while with different articles, so I made them base on a template.
Now I need to load the fiction into the page. I have two ideas to achieve this.
One is by storing it in the database. However, each fiction has a large and different letter count. It seems not well to store it in the database.
The other is by storing it in a .Txt file, then load and cache it. Whereas, I don't know how to set the.Txt file to private(not allow download the .Txt file by any other people).
I am not sure which of my idea is right. Or there is a better solution. Would you please give me a suggestion? Thank you.
Participant
980 Points
327 Posts
Re: How should I load article by asp.net core?
Nov 05, 2020 05:31 AM|Jerry Cai|LINK
Hi,mywatermelon
If the fiction is a plaintext,
fictionnames. And fiction model can be bound to chapters for easy management and query.
I recommend using the database method, although the design is complicated but it will be easy to manage.
Best Regards,
Jerry Cai
Member
53 Points
246 Posts
Re: How should I load article by asp.net core?
Nov 05, 2020 06:28 AM|mywatermelon|LINK
Thanks for helping me.
I am sorry I don't know what is the plaintext truly means. It seems it is an HTML element that has been abandon.
The article I need to store just like this:
<h1>Harry Potter</h1>
<article>Harry Potter is a series of seven fantasy novels written by British author J. K. Rowling. The novels chronicle the lives of a young wizard, Harry Potter, and his friends Hermione Granger and Ron Weasley, all of whom are students at Hogwarts School of Witchcraft and Wizardry. The main story arc concerns Harry's struggle against Lord Voldemort, a dark wizard who intends to become immortal, overthrow the wizard governing body known as the Ministry of Magic and subjugate all wizards and Muggles (non-magical people).</article>
All-Star
194495 Points
28079 Posts
Moderator
Re: How should I load article by asp.net core?
Nov 05, 2020 07:22 AM|Mikesdotnetting|LINK
If the article content is HTML, use @Html.Raw() to output it is Razor.
Member
53 Points
246 Posts
Re: How should I load article by asp.net core?
Nov 05, 2020 08:57 AM|mywatermelon|LINK
Thank you so much.