Click or drag to resize

HelperDatabaseIsChangedDataClass Method

Check is object pApp null, is parameter pConnectionString no equal to App property, is parameter pUserName no equal to App property

Namespace:  SOWIData.Database
Assembly:  SOWIData (in SOWIData.dll) Version: 19.1.23.1 (19.1.23.622)
Syntax
public static bool DatabaseIsChanged<DataClass>(
	this IConnector<DataClass> pApp,
	string pConnectionString,
	string pUserName
)

Parameters

pApp
Type: SOWIData.DatabaseIConnectorDataClass
This parameter must based on ConnectorDataItemClass because read properties ConnectionString and UserName
pConnectionString
Type: SystemString
Connection string to check as changed
pUserName
Type: SystemString
User name to check as changed

Type Parameters

DataClass

[Missing <typeparam name="DataClass"/> documentation for "M:SOWIData.Database.Helper.DatabaseIsChanged``1(SOWIData.Database.IConnector{``0},System.String,System.String)"]

Return Value

Type: Boolean
Value true or false. True: yes, to must new load. False: no, App has a instance and parameters (pConnectionString, pUserName) doesn't changed

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IConnectorDataClass. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Examples
Declaration temporary objects
/// <summary>
/// App object on memory for a better performance
/// </summary>
private static App.Customer App = null;

/// <summary>
/// Data list on memory for a better performance
/// </summary>
private static List<Data.Customer> DataList = null;
Check necessary a new App instance or reread data list
#region --- database ---

//* checks database access connection string *
if (pConnectionString.Length == 0)
{
    //* puts SOWIApp.sconfig current configuration *
    pConnectionString = SOWIApp.Management.Data.Settings.Database.Setting.ConnectionString;
}

//* checks database access user name *
if (pUserName.Length == 0)
{
    //* puts logged user name *
    pUserName = System.Environment.UserName;
}

//* do check necessary a new instance of App *
lDatabaseIsChanged = App.Customer.App.DatabaseIsChanged(pConnectionString, pUserName);
if (lDatabaseIsChanged)
{
    App.Customer.App = new Customer(pConnectionString, pUserName);
}

//* do check necessary load data list *
if (App.Customer.DataList == null)
{
    lDatabaseIsChanged = true;
}

#endregion

//* do check necessary reread data list *
if (lDatabaseIsChanged)
{
    App.Customer.DataList = App.Customer.App.GetList();
}
See also a complete example "How to programming data access performance"
See Also