Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8103171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:27:44+00:00 2026-06-05T23:27:44+00:00

As you can understand from title, i modified Settings.cs file.Added some properties, some code

  • 0

As you can understand from title, i modified Settings.cs file.Added some properties, some code to constractor (public Settings()) and overrided Save() function.But it is a patial class so i know what kind of consequences you have to face when you modify IDE generated files especially .designers.It is not a designer but an IDE generated internal sealed partial and i want to know is it 100% safe or not?

internal sealed partial class Settings
{
    public System.Data.SqlClient.SqlConnection AppDbConnection
    {
      get 
      {
        if (_AppDbConnection == null)
        {
          try
          {
            _AppDbConnection = new System.Data.SqlClient.SqlConnection(_ConnectionString);
            _AppDbConnection.Open();
          }
          catch (System.Exception ex) { throw ex; }
        }
        return _AppDbConnection;
      }
    }

    private System.Data.SqlClient.SqlConnection _AppDbConnection;
    private string _ConnectionString;


public override void Save()
{
  System.IO.FileInfo fi = new System.IO.FileInfo(System.Windows.Forms.Application.StartupPath + "\\Settings.dat");
  System.IO.FileStream fs = new System.IO.FileStream(fi.FullName, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write);
  System.IO.StreamWriter sw = new System.IO.StreamWriter(fs, System.Text.Encoding.GetEncoding("iso-8859-9"));
  try { sw.Write(Helper.BinarySerializer.ToBinary(_SettingsBase)); }
  catch (System.Exception ex) { throw ex; }
  finally { sw.Close(); fs.Close(); }
  base.Save();
}


    public Settings()
    {
      try
      {
        System.IO.FileInfo fi = new System.IO.FileInfo(System.Windows.Forms.Application.StartupPath + "\\Settings.dat");
        if (fi.Exists)
        {
          System.IO.FileStream fs = new System.IO.FileStream(fi.FullName, System.IO.FileMode.Open, System.IO.FileAccess.Read);
          System.IO.StreamReader sr = new System.IO.StreamReader(fs, System.Text.Encoding.GetEncoding("iso-8859-9"));
          string data = sr.ReadToEnd();
          if (data != "")
          {
_SettingsBase = (AppCode.SettingsBase)Helper.BinarySerializer.BinaryTo(data);
            _ConnectionString = Helper.Crypto.DecryptString(_SettingsBase.ConnectionString, "");
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T23:27:46+00:00Added an answer on June 5, 2026 at 11:27 pm

    If your additions are in a separate file that was not created by some code generation tool, then the IDE won’t overwrite your changes (just don’t name it something ending with *.designer.cs, just in case).
    So that would be at least safe from the IDE’s code generation.

    Do not edit the files generated by visual studio (Those file usually have a comment at the top warning you about this).

    Autogenerated files like this are one of the main reasons to declare classes as partial, so that you can extend it in another file without fear that your changes are overwritten.

    Note: Any sensitive data in that connection string won’t be safe though

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone please explain how to understand a logcat from an android force close.
As I understand it I can use reverse P/Invoke to call C# from C++.
Using a delegate I can call any function asynchronously. From the documentation I understand
As you understand from the title above, I have a datatable and checkboxes in
I have a problem in my code which i can't understand. I want to
As you can see from the title I basically want to update a plist.
Sorry for a poor title, feel free to edit. I can't understand what the
(Someone edit the title if you can understand and define my problem better.) The
I understand the title may be a little vague, but, hopefully, I can explain
I'm receiving an error from roxygenize() that I can't understand. I have a package

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.