/// <summary> /// Creates a new <see cref="KLinkDirectSQL"/> instance to be used with direct Microsoft SQL Server databases. /// It automatically creates an instance of <see cref="KFactoryDirectSQL"/> in order to specify its personality. /// </summary> /// <param name="connString">The connection string to be used to create connections when needed.</param> /// <param name="caseSensitiveNames">Whether the names of tables and columns in the database are to be consider case /// sensitive or not.</param> /// <param name="mode">The default transactional mode to use when creating automatic transactions.</param> public KLinkDirectSQL( string connString, bool caseSensitiveNames = false, KTransactionMode mode = KTransactionMode.Scope ) : base( new KFactoryDirectSQL(), connString, caseSensitiveNames, mode ) { DEBUG.IndentLine( "\n-- KLinkDirectSQL( Factory, Connection, CaseSensitive, Mode )" ); DEBUG.Unindent(); }
/// <summary> /// Creates a new <see cref="KLinkDirect"/> instance initialized with the arguments given. /// </summary> /// <param name="factory">The factory defining the personality of the database.</param> /// <param name="connString">The connection string to be used to create connections when needed.</param> /// <param name="caseSensitiveNames">Whether the names of tables and columns in the database are to be consider case /// sensitive or not.</param> /// <param name="mode">The default transactional mode to use when creating automatic transactions.</param> public KLinkDirect( IKFactoryDirect factory, string connString, bool caseSensitiveNames = false, KTransactionMode mode = KTransactionMode.Scope ) : base( factory ) { DEBUG.IndentLine( "\n-- KLinkDirect( Factory, Connection={0}, CaseSensitive={1}, Mode={2} )", connString ?? "null", caseSensitiveNames, mode ); _DbCaseSensitiveNames = caseSensitiveNames; _TransactionMode = mode; DbConnectionString = connString; // Through the property DEBUG.Unindent(); }
/// <summary> /// Sets the default transaction mode this proxy will use with the underlying database. If a transaction is already /// active, it might throw an exception. /// </summary> /// <param name="mode">The transaction mode to set as the default.</param> public void SetTransactionMode( KTransactionMode mode ) { DEBUG.IndentLine( "\n-- [{0}] KServerWCF.SetTransactionMode( Mode={1} )", _ProxyId.TagString(), mode ); try { if( _Link == null ) throw new InvalidOperationException( "WCF Server is not yet connected." ); _Link.TransactionMode = mode; } catch( Exception e ) { DEBUG.PrintException( e ); throw; } finally { DEBUG.Unindent(); } }