C#- resource file

RameshLathu
RameshLathu used Ask the Experts™
on
Hi Experts,

I have a batch job (console app) which will fetch data from external excel file and create a HTML file.

I am not creating the HTML file dynamically, instead, I will be having a standard HTML template (.htm) and I need to fill the html files with the values I fetch from excel.

I divided the html files in to different sections(based on my entity) and stored the html sections in Resource file.

For eg, in resource file,

"PolicySection"

and value for PolicySEction in resource file is,


  <TR style="font-size: 12pt">
    <TD style="height: 16px; width: 297px;"><FONT size=1>enter</FONT></TD>
    <TD width="297" style="font-size: 12pt; height: 16px"><FONT size=1>RateEffectiveDateRenewingFrom</FONT></TD>
    <TD width="222" style="font-size: 12pt; height: 16px">RateEffectiveDateRenewingFromValue
        &nbsp;</TD>
  </TR>
  <TR style="font-size: 12pt">
    <TD style="height: 16px; width: 297px;"><FONT size=1>enter</FONT></TD>
    <TD width="297" style="font-size: 12pt; height: 16px;"><FONT size=1>RateEffectiveDateRenewingTo</FONT></TD>
    <TD width="222" style="font-size: 12pt; height: 16px;">RateEffectiveDateRenewingToValue
        &nbsp;</TD>
  </TR>


At runtime I will read this string and replace "RateEffectiveDateRenewingToValue" with the actual values.

My question is,

In my project, I have three resource files

1. To store sections of HTML file
2. To store whole basic template of html file
3. To store all other project related configuration

I am using three different file, just for not getting confused and it will look neat.

Is it OK, to keep three resource files and having lot of strings in it?
For eg, I will be having the whole html file as a string in one of my resource file?

Will there be any performance issue?

So far, its working fine. It is just a samll batch job, used internally.

Please suggesst.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Meir RivkinFull stack Software Engineer
Commented:
there's no problem to have the whole html in the resource file.
usually u use the resource file when localization is required cause VS provides functionality to change language easier using different resource files.
the standard is to use something like:
resource.en.resx for english, resource.fr.resx for french and so on.
since this is not the case it doesn't really matters.
separate to 3 files is good idea just to make everything clearer in your solution.
Meir RivkinFull stack Software Engineer

Commented:
how often do u load those resource files and manipulate them to create the html file?

Author

Commented:
Thank you for ur reply.

Whenever the user runs the batch, I need to read the excel, and create html file with values.

So, for one run,  I have around 15-20 entities, (I have 15 classes) which will refer its respective section in the resource file.

For eg, in policy.cs,

I will call resource file 2 times (one for current policy and one for prior policy)

string LstrPolicy = HTMLResource.PolicySection;

Some times, if i want the same section 5 times, I will run this inside the foreach loop.

I tried to test by palcing 20 excel files in my folder and created 20 html files. Its doing it in leass than one min.

Please suggesst.
Angular Fundamentals

Learn the fundamentals of Angular 2, a JavaScript framework for developing dynamic single page applications.

Meir RivkinFull stack Software Engineer

Commented:
how often the user runs the batch?
the time consuming part is reading the excel but u can't avoid or cut the time so its fine.

Author

Commented:
That depends.....

The excel contains test data, the user will create n number of excels based on their testing data.

The idea is each every tester will have their own exe in their local.

They will create one excel/ n number of excels (based on their comfort) and run the batch.

The batch will create the html files. And this HTML file will be used as a input for another engine.

The batch exe will be individual users loacal system.
Full stack Software Engineer
Commented:
in case its fine, i'd add the batch file something that notifies the user something like "processing files..." in the batch console.

Author

Commented:
Thank you for your suggesstions and answer

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial