clsapplicationparams.cs
来自「LLBLGen 1.21 Sourcecode」· CS 代码 · 共 341 行
CS
341 行
//////////////////////////////////////////////////////////////////////
// Part of LLBLGen sourcecode. See version information
//////////////////////////////////////////////////////////////////////
// COPYRIGHTS:
// Copyright (c)2002 Solutions Design. All rights reserved.
//
// Released under the following license: (BSD2)
// -------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// 1) Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
// 2) Redistributions in binary form must reproduce the above copyright notice, this list of
// conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY SOLUTIONS DESIGN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOLUTIONS DESIGN OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// The views and conclusions contained in the software and documentation are those of the authors
// and should not be interpreted as representing official policies, either expressed or implied,
// of Solutions Design.
//
//////////////////////////////////////////////////////////////////////
// Contributers to the code:
// - Frans Bouma [FB]
//////////////////////////////////////////////////////////////////////
using System;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Soap;
using System.Windows.Forms;
namespace LLBLGen
{
/// <summary>
/// Purpose: general application parameter class. All gui parameters have an equivalent
/// parameter in this class. The class is custom binded to the controls by a routine
/// not by .NET bindable classes. It's serializable so settings can be written to disk/loaded
/// from disk.
/// </summary>
[Serializable]
public class clsApplicationParams
{
private const string sSERIALIZED_CLASS_FILENAME = "clsApplicationParams.out";
#region Class Member Declarations
private bool m_bSQLWindowsAuthentication, m_bNETIncludeAutoComplete, m_bNETIncludeJITSupport,
m_bNETIncludeLoadBalancingSupport, m_bNETIncludeObjectPoolingSupport,
m_bSPGenerateSelectAllSPs, m_bSPPrefixParams, m_bSPGenerateDeleteSPs, m_bSPGenerateInsertSPs,
m_bSPGenerateUpdateSPs, m_bSPGenerateSelectSPs, m_bSPIncludeComments, m_bSPIncludeDrops,
m_bSPIncludeErrorCodeSupport, m_bNETIncludeNullValueSupport, m_bSPUseFieldListSelectClause,
m_bNETIncludeTransactionSupport, m_bNETIncludeCOMPlusSupport, m_bNETPrefixProperties,
m_bNETStyleHungarian, m_bNETIncludeComments, m_bSPIncludeNoCountStatements,
m_bNETIncludeConnectionProviderSupport;
private string m_sSQLCatalog, m_sSQLServer, m_sSQLUID, m_sNETNamespace, m_sSPNamePrefix,
m_sSPOutputPath, m_sNETOutputPath, m_sNETClassPrefix;
private int m_iNETConnectionStringRetrieval, m_iNETOutputLanguage;
#endregion
/// <summary>
/// Purpose: Constructor.
/// </summary>
public clsApplicationParams()
{
Initialize();
}
/// <summary>
/// Purpose: initalizes all membervariables with a default value. If you don't like the
/// default values, change them here.
/// </summary>
public void Initialize()
{
m_bSQLWindowsAuthentication = true;
m_bNETIncludeAutoComplete = false;
m_bNETIncludeJITSupport = false;
m_bNETIncludeLoadBalancingSupport = false;
m_bNETIncludeObjectPoolingSupport = false;
m_bSPGenerateSelectAllSPs = true;
m_bSPPrefixParams = true;
m_bSPGenerateDeleteSPs = true;
m_bSPGenerateInsertSPs = true;
m_bSPGenerateUpdateSPs = true;
m_bSPGenerateSelectSPs = true;
m_bSPIncludeComments = true;
m_bSPIncludeDrops = true;
m_bSPIncludeErrorCodeSupport = true;
m_bNETIncludeNullValueSupport = false;
m_bSPUseFieldListSelectClause = true;
m_bNETIncludeTransactionSupport = false;
m_bNETIncludeCOMPlusSupport = false;
m_bNETPrefixProperties = true;
m_bNETStyleHungarian = true;
m_bNETIncludeComments = true;
m_bNETIncludeConnectionProviderSupport = false;
m_bSPIncludeNoCountStatements = true;
m_iNETOutputLanguage = (int)eDotNetLanguages.CSharp;
m_iNETConnectionStringRetrieval = (int)eConnectionStringRetrieval.AppConfig;
m_sSQLCatalog = "";
m_sSQLServer = "(local)";
m_sSQLUID = "sa";
m_sNETNamespace = "";
m_sSPNamePrefix = "pr_";
m_sSPOutputPath = Application.StartupPath + "\\StoredProcedures\\";
m_sNETOutputPath = Application.StartupPath + "\\Classes\\";
m_sNETClassPrefix = "cls";
}
/// <summary>
/// Purpose: writes this class to disk using serialization. The written file is read back at the start
/// of the application. Caller will have to handle exceptions
/// </summary>
public void Store()
{
// serialize the current instance
FileStream fsOutput = new FileStream(sSERIALIZED_CLASS_FILENAME, FileMode.Create);
SoapFormatter sfFormatter = new SoapFormatter();
sfFormatter.Serialize(fsOutput,this);
fsOutput.Close();
}
/// <summary>
/// Purpose: reads back a serialized version of an instance of this class and returns that
/// instance.
/// </summary>
/// <returns>Instance of serialized object instance of this class.</returns>
/// <remarks>Static method</remarks>
public static clsApplicationParams RetrieveSerialized()
{
try
{
clsApplicationParams apToReturn;
// test if file exists.
if(File.Exists(sSERIALIZED_CLASS_FILENAME))
{
// read back serialized objectinstance
FileStream fsOutput = new FileStream(sSERIALIZED_CLASS_FILENAME, FileMode.Open);
SoapFormatter sfFormatter = new SoapFormatter();
apToReturn = (clsApplicationParams)sfFormatter.Deserialize(fsOutput);
fsOutput.Close();
}
else
{
// return new instance
apToReturn = new clsApplicationParams();
}
return apToReturn;
}
catch
{
// General error, bubble
throw;
}
}
#region Class Property Declarations
public bool bNETIncludeConnectionProviderSupport
{
get { return m_bNETIncludeConnectionProviderSupport; }
set { m_bNETIncludeConnectionProviderSupport = value; }
}
public int iNETConnectionStringRetrieval
{
get { return m_iNETConnectionStringRetrieval; }
set { m_iNETConnectionStringRetrieval = value;}
}
public int iNETOutputLanguage
{
get { return m_iNETOutputLanguage; }
set { m_iNETOutputLanguage = value;}
}
public bool bSQLWindowsAuthentication
{
get { return m_bSQLWindowsAuthentication; }
set { m_bSQLWindowsAuthentication = value; }
}
public bool bNETIncludeAutoComplete
{
get { return m_bNETIncludeAutoComplete; }
set { m_bNETIncludeAutoComplete = value; }
}
public bool bNETIncludeJITSupport
{
get { return m_bNETIncludeJITSupport; }
set { m_bNETIncludeJITSupport = value; }
}
public bool bNETIncludeLoadBalancingSupport
{
get { return m_bNETIncludeLoadBalancingSupport; }
set { m_bNETIncludeLoadBalancingSupport = value; }
}
public bool bNETIncludeObjectPoolingSupport
{
get { return m_bNETIncludeObjectPoolingSupport; }
set { m_bNETIncludeObjectPoolingSupport = value; }
}
public bool bSPGenerateSelectAllSPs
{
get { return m_bSPGenerateSelectAllSPs; }
set { m_bSPGenerateSelectAllSPs = value; }
}
public bool bSPPrefixParams
{
get { return m_bSPPrefixParams; }
set { m_bSPPrefixParams = value; }
}
public bool bSPGenerateDeleteSPs
{
get { return m_bSPGenerateDeleteSPs; }
set { m_bSPGenerateDeleteSPs = value; }
}
public bool bSPGenerateInsertSPs
{
get { return m_bSPGenerateInsertSPs; }
set { m_bSPGenerateInsertSPs = value; }
}
public bool bSPGenerateUpdateSPs
{
get { return m_bSPGenerateUpdateSPs; }
set { m_bSPGenerateUpdateSPs = value; }
}
public bool bSPGenerateSelectSPs
{
get { return m_bSPGenerateSelectSPs; }
set { m_bSPGenerateSelectSPs = value; }
}
public bool bSPIncludeComments
{
get { return m_bSPIncludeComments; }
set { m_bSPIncludeComments = value; }
}
public bool bSPIncludeDrops
{
get { return m_bSPIncludeDrops; }
set { m_bSPIncludeDrops = value; }
}
public bool bSPIncludeErrorCodeSupport
{
get { return m_bSPIncludeErrorCodeSupport; }
set { m_bSPIncludeErrorCodeSupport = value; }
}
public bool bNETIncludeNullValueSupport
{
get { return m_bNETIncludeNullValueSupport; }
set { m_bNETIncludeNullValueSupport = value; }
}
public bool bSPUseFieldListSelectClause
{
get { return m_bSPUseFieldListSelectClause; }
set { m_bSPUseFieldListSelectClause = value; }
}
public bool bNETIncludeTransactionSupport
{
get { return m_bNETIncludeTransactionSupport; }
set { m_bNETIncludeTransactionSupport = value; }
}
public bool bNETIncludeCOMPlusSupport
{
get { return m_bNETIncludeCOMPlusSupport; }
set { m_bNETIncludeCOMPlusSupport = value; }
}
public bool bNETPrefixProperties
{
get { return m_bNETPrefixProperties; }
set { m_bNETPrefixProperties = value; }
}
public bool bNETStyleHungarian
{
get { return m_bNETStyleHungarian; }
set { m_bNETStyleHungarian = value; }
}
public bool bNETIncludeComments
{
get { return m_bNETIncludeComments; }
set { m_bNETIncludeComments = value; }
}
public bool bSPIncludeNoCountStatements
{
get { return m_bSPIncludeNoCountStatements; }
set { m_bSPIncludeNoCountStatements = value; }
}
public string sSQLCatalog
{
get { return m_sSQLCatalog; }
set { m_sSQLCatalog = value; }
}
public string sSQLServer
{
get { return m_sSQLServer; }
set { m_sSQLServer = value; }
}
public string sSQLUID
{
get { return m_sSQLUID; }
set { m_sSQLUID = value; }
}
public string sNETNamespace
{
get { return m_sNETNamespace; }
set { m_sNETNamespace = value; }
}
public string sSPNamePrefix
{
get { return m_sSPNamePrefix; }
set { m_sSPNamePrefix = value; }
}
public string sSPOutputPath
{
get { return m_sSPOutputPath; }
set { m_sSPOutputPath = value; }
}
public string sNETOutputPath
{
get { return m_sNETOutputPath; }
set { m_sNETOutputPath = value; }
}
public string sNETClassPrefix
{
get { return m_sNETClassPrefix; }
set { m_sNETClassPrefix = value; }
}
#endregion
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?