Home / documentazione
Name Modified Size InfoDownloads / Week
Parent folder
readme.txt 2017-07-25 4.4 kB
references da aggiungere.PNG 2017-07-25 8.8 kB
Totals: 2 Items   13.1 kB 0
/* **********************

Le classi devono essere configurate tramite le seguenti chiavi, da COPIARE nel file Web.Config.
Inoltre, fanno uso della DLL "log4net.dll" da inserire nella cartella BIN dell’applicazione.
La classe DataBaseLibrary, se rileva una eccezione, puo’ provare a rieseguire il metodo chiamato <N> volte, 
<Infinite> volte oppure NON adottare codesta logica, se essa è disabilitata (KEY_RetryNeeded value=false, valore settato di default).

********************** */

<appSettings>
<!-- NOME DELLA CHIAVE PER LA STRINGA DI CONNESSIONE -->
<add key="KEY_DefaultConnectionString" value ="DefaultConnectionString" /> 

<!-- RETRY ABILITATA/DISABILITATA -->
<add key="KEY_RetryNeeded" value ="false" /> 

<!-- NUMERO DI PROVE PER ESEGUIRE DI NUOVO LE STORED PROCEDURES -->
<add key="KEY_NumeroRetry" value ="1"   /> 

<!-- PROVE DI RETRY INFINITE -->
<add key="KEY_RetryInfiniti" value ="false"  /> 
</appSettings>




// Sezione per Log4net 
// -------------------
<configSections>
   <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
</configSections>

// Sezione da inserire dopo il tag </appSettings>
<log4net debug="true">
  <appender name="Dailyroller" type="log4net.Appender.RollingFileAppender">
    <param name="File" value="NOMELOG.log" />  <<---- (CAMBIARE IL NOME DEL LOG)
    <appendToFile value="true" />
    <rollingStyle value="Date" />
    <datePattern value=".yyyyMMdd" />
    <maxSizeRollBackups value="365" />
    <maximumFileSize value="150MB" />
    <staticLogFileName value="true" />
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%newline%level on %date{dd/MM/yyyy HH:mm:ss}%newline[%method] %message%newline" />
    </layout>
  </appender>

 <root>
    <level value="ALL" />
    <appender-ref ref="Dailyroller" />
 </root>
</log4net>


// ConnectionStrings
<connectionStrings>
    <add name="DefaultConnectionString" 
             connectionString="Data Source=SERVER;Initial 
             Catalog=NOMEDATABASE;User  
             ID=USERID" providerName="System.Data.SqlClient"/>

    <add name="CustomConnectionString" 
             connectionString="Data Source=SERVER;Initial 
             Catalog=NOMEDATABASE;User  
             ID=USERID" providerName="System.Data.SqlClient"/>
</connectionStrings>



/* **********************
Una volta configurati i parametri di cui sopra nel file Web.Config, le classi sono pronte per essere usate nell’applicazione. 
Di default, la chiave <nomeChiaveConnString> è il nome della chiave che contiene la ConnectionString al Database principale.

Se si vuole usare un Database secondario, 
dall’applicazione che usa la classe DataBaseLibrary settare la proprieta’ CustomConnString nel seguente modo:

Codice:
istanzaClasse.CustomConnString="Nome_StringaConnessione_Secondario"; 

(Nome_StringaConnessione_Secondario = La chiave che contiene la connectionstring)

in modo da abilitare la connessione al database alternativo.
********************** */



/* **********************
USING:

using nsCommonLibrary;
using nsDatabaseLibrary;
using nsLog4NetLibrary;
using nsRoleProviderLibrary;
using nsSecurityLibrary;
using nsSimpleDatabaseLibrary;
********************** */




USO Libreria DB
==============
DatabaseLibrary db = new DatabaseLibrary();

            // In
            SqlParameter p1 = new SqlParameter("@requestid", SqlDbType.VarChar);
            p1.Value = requestId;

            SqlParameter p2 = new SqlParameter("@Processo", SqlDbType.Int);
            p2.Value = threadId;

 
            // Out
            SqlParameter p3 = new SqlParameter("@resultcode", SqlDbType.Int);
            p9.Direction = ParameterDirection.Output;   

            SqlParameter[] parametriRichiesta = { p1, p2, p3 };

            try
            {
                int retValue = db.ExecStored("PAYMAT_SMART_LOG", "sp_MSG_INS_RequestWebService", parametriRichiesta);

				//out
                int rsCode = int.Parse(p9.Value.ToString()); // @resultcode
                             
            }
            catch (Exception ex)
            {
                logger.Error("Errore esecuzione procedura [sp_MSG_INS_RequestWebService]  ", ex);              
            }
Source: readme.txt, updated 2017-07-25