Dynamically Update Resource file in Asp.Net Mvc - c#

I have Asp.net MVC as a Class library. All of my .resx files are also in the same class library project as Embedded resource. So basically ill get output as a dll
And my requirement is that i need a page where i can get all the key value pair from the .resx files from the dll (which is bit easy) and again update the resx in the dll to reflect the changes on screen.
So the basic idea is I need a page where i can dynamically update the .resx file which are avaliable as the external class library. And the updated resources must be seen 'AS UPDATED' wherever needed.
Any Kind suggestions or some other working approach heartly welcomed.

Related

Extracting a class file from a Business Logic Layer DLL file and modifying it as a separate class.

I've recently taken over working on a .NET site. The original developer is uncontactable so that I don't have the source files, all I have are the aspx files and their corresponding .cs code behind files. The business logic is compiled in a file called BLL.dll
Up until now this has been fine, as I've only needed to make fairly superficial changes, that could be done by editing the .aspx or codebehind files, however, no I need to make a small change to a method contained in BLL.dll file. I've been able to decompile the files using DotPeek and can copy the code from the class file I want to edit. From what I've read, recompiling decompiled DLL files isn't advised (if even possible at all).
My question is, can a single file from this DLL be used as a standalone class file in my App_Code folder, or will there be dependencies within the DLL that can't be accessed by a standalone class.
I've tried creating it as a standalone class file, but am getting the error that 'System.Transactions' could not be found, although it seems to be working when it's referenced in the compiled BLL.dll file.
I'm a novice at .NET, so please excuse my ignorance.
Thanks

.NET WPF - Why do I need the .resource file when the .dll should be enough?

For the project I'm currently working, I am creating resource files (.resx). I am using Resgen.exe and AL.exe to create .resource and .dll files. The Build Action for the .resx files is set to "None".
The idea is to allow customers to provide their own localization if what we provide does not suit their needs.
The problem I'm having is that the .resource files are absolutely necessary in the delivered product. I was under the impression that the .resources.dll file be sufficient. Are the .resource files really needed in the finished product or am I doing something wrong?
EDIT: I have recently discovered that helper files were specifically looking for .resource files. I have modified the code to use the .dll, but now strings are not being returned. So now my question is "how do I access the .resources.dll to retrieve the strings?"
Are you following a guide that says to set the build action to None? That seems like a mistake to me. If the build action is set to none, then it cannot be included in the library assembly.
I would try setting them to Embedded Resource.

Dll of a single C# code behind page

I a using ASP.net website - 3.5 C#
I have a modification in a .cs page, I have to deliver only updates for this code behind file only to client. Is there any way to create dll for this page in the website ?
No, it is impossible to create an assembly from a single code behind page that is part of a website project.
The web project gets compiled into a single assembly - all code behind files become part of this assembly. An update to a single code behind file means that you need to recompile the project and deploy the updated assembly.
If you can change the project from a website project to a web application, this would be a different matter, as IIS would compile all code behind files on the fly, so updating a single code behind file is possible.
To create an assembly you will need to create a project class library project. In this project you will create your .cs class file. When you build this it will produce the DLL file.
Unfortuantely you cannot create web pages in this type of project.
Now to use this in your website you can either add a project reference to this class library project, or add a file reference to the DLL it produced
Select the highlighted part as mentioned in the screen shot and Publish it.

Packaging ResourceDictionary for Silverlight Class Library

I have a silverlight class library (not a top-level application) with several user controls that are shared by different silverlight applications. I have gone through and pulled out several styles and brushes for the controls and put them in a separate XAML file as a resource dictionary which I bring into each control as a merged resource dictionary. Right now this works great in my top-level applications, as long as I keep that resource dictionary as a "Resource" build action and reference it in that way from the controls.
What I would really like to do is have this resource dictionary XAML file as a "Content" build action which gets copied into the top-level XAP, so that the XAML can be swapped out in the XAP file without needing to rebuild the project. Whenever I try to set this up, the XAML file will get copied into the output bin for the class library project, but it will never get copied to my top-level silverlight application project output directory or into the final XAP file.
What is the best way to accomplish this? The XAML resource dictionary is essentially a dependency of the class library, and the class library (of user controls) is a dependency of the top-level silverlight application.
Add the ControlResources.xaml (the ResourceDictionary you want in your XAP) to the top-level XAP project as a link via Project->Add Existing Item->Add as Link (a drop down item on the Add button in the dialog), and set it to build as Content, also.
Will merged dictionaries meet your needs?
http://www.silverlight.net/learn/videos/silverlight-videos/hdi-sl3-merged-resources/
http://thoughtjelly.blogspot.com/2009/10/cross-project-mergeddictionaries-in.html
http://www.liquidjelly.co.uk/supersearch/?q=silverlight%20merged%20resource%20dictionaries&lang=en-GB
Best,
Mark

Localization in Class Library

I would like to localize my c# class library
The library will output a .dll file, which I will distribute to .net application bin folders.
I want localization in the class library but I do not want to have to recompile the DLL each time a localization change is required.
So ideally....
have c# class with resx files outside the assembly, so that when the contents of the resx changes, all that should be required is that the asp.net host application might require a restart.
Best case scenario, is that the asp.net host application doesn't require a restart.
Thanks in advance for your advice - the resx file will just hold string values.
If possible I would like to do this using a best practice method, or at least without writing a whole custom localization solution.
Check this stackoverflow question.
Is there any performance difference in using .resx file and satellite assembly?
Looks like you can have a seperate resource dll.

Categories

Resources