Click here to Skip to main content
15,885,278 members
Articles / Desktop Programming / Windows Forms

Asynchronous data loading and data binding with Windows Forms

Rate me:
Please Sign up or sign in to vote.
4.29/5 (6 votes)
15 Dec 2008CPOL3 min read 48.5K   1.8K   55  
This article introduces a reusable library that contains two utility components for data binding and asynchronous data loading.
<?xml version="1.0"?>
<doc>
    <assembly>
        <name>NHibernate.JetDriver</name>
    </assembly>
    <members>
        <member name="T:NHibernate.JetDriver.JetCaseFragment">
            <summary>
            Jet engine doesn't support CASE ... WHEN ... END syntax, but has a proprietary "Switch". 
            </summary>
            <remarks>
            Author: <a href="mailto:lukask@welldatatech.com">Lukas Krejci</a>
            </remarks>
        </member>
        <member name="T:NHibernate.JetDriver.JetDbCommand">
            <summary>
            JetDbCommand is just a wrapper class for OleDbCommand with special handling of datatypes needed when storing
            data into the Access database.
            These type conversion are performed in command parameters:
            1) DateTime, Time and Date parameters are converted to string using 'dd-MMM-yyyy HH:mm:ss' format.
            2) Int64 parameter is converted to Int32, possibly throwing an exception.
            
            Because of the diference between the way how NHibernate defines identity columns and how Access does, I have to
            incorporate another dirty hack here. Because NHibernate does not always use its driver to generate commands 
            (ie. in Schema creation classes), this functionality has to be moved "down" to the IDbCommand object. 
            IMO, everything in NHibernate should call db queries using its drivers, but at the present time it is not true.
            If it was, we could move the replacing functionality up to the driver class, where it's more appropriate, although it
            is still a dirty hack :)
            
            <p>
            Author: <a href="mailto:lukask@welldatatech.com">Lukas Krejci</a>
            </p>
            </summary>
        </member>
        <member name="M:NHibernate.JetDriver.JetDbCommand.CheckParameters">
            <summary>
            So far, the only data type I know about that causes Access to fail everytime is DateTime.
            The solution to the problem is to convert the date to a string representing it.
            </summary>
        </member>
        <member name="T:NHibernate.JetDriver.JetDbConnection">
            <summary>
            Wrapper class for OleDbConnection to support MS Access dialect in NHibernate.
            
            <p>
            Author: <a href="mailto:lukask@welldatatech.com">Lukas Krejci</a>
            </p>
            </summary>
        </member>
        <member name="T:NHibernate.JetDriver.JetDbTransaction">
            <summary>
            Summary description for JetDbTransaction.
            
            <p>
            Author: <a href="mailto:lukask@welldatatech.com">Lukas Krejci</a>
            </p>
            </summary>
        </member>
        <member name="T:NHibernate.JetDriver.JetDialect">
            <summary>
            Dialect for Jet database engine.
            
            <p>
            Author: <a href="mailto:lukask@welldatatech.com">Lukas Krejci</a>
            </p>
            </summary>
        </member>
        <member name="M:NHibernate.JetDriver.JetDialect.#ctor">
            <summary>
            
            </summary>
        </member>
        <member name="M:NHibernate.JetDriver.JetDialect.AddIdentitySelectToInsert(NHibernate.SqlCommand.SqlString,System.String,System.String)">
            <summary>
            Add the Identity Select string to the Insert Sql.
            Not supported by Access.
            </summary>
            <param name="insertSql">The SqlString that contains the INSERT sql.</param>
            <returns>null.</returns>
        </member>
        <member name="M:NHibernate.JetDriver.JetDialect.GetIdentitySelectString(System.String,System.String)">
            <summary></summary>
        </member>
        <member name="M:NHibernate.JetDriver.JetDialect.Quote(System.String)">
            <summary>
            
            </summary>
            <param name="name"></param>
            <returns></returns>
            <remarks>
            MsSql does not require the OpenQuote to be escaped as long as the first char
            is an OpenQuote.
            </remarks>
        </member>
        <member name="M:NHibernate.JetDriver.JetDialect.UnQuote(System.String)">
            <summary>
            
            </summary>
            <param name="quoted"></param>
            <returns></returns>
        </member>
        <member name="M:NHibernate.JetDriver.JetDialect.CreateCaseFragment">
            <summary>
            Create an <c>CaseFragment</c> for this dialect
            </summary>
            <returns></returns>
        </member>
        <member name="P:NHibernate.JetDriver.JetDialect.LowercaseFunction">
            <summary>
            The name of the SQL function that transforms a string to lowercase
            </summary>
        </member>
        <member name="P:NHibernate.JetDriver.JetDialect.SupportsIdentityColumns">
            <summary></summary>
        </member>
        <member name="P:NHibernate.JetDriver.JetDialect.IdentityColumnString">
            <summary>
            Access is not conforming to standards of other databases in identity/autoincrement columns specifications.
            Instead of something like "INT NOT NULL AUTO_INCREMENT" for MySQL or "INT IDENTITY NOT NULL" for MsSQL, 
            Access autoincremented column has a special datatype - COUNTER. This is not compatible with NHibernate way
            of doing things, so I define some non-SQL string, that is translated in the JetDbCommand..
            </summary>
        </member>
        <member name="P:NHibernate.JetDriver.JetDialect.NoColumnsInsertString">
            <summary></summary>
        </member>
        <member name="P:NHibernate.JetDriver.JetDialect.CloseQuote">
            <summary></summary>
        </member>
        <member name="P:NHibernate.JetDriver.JetDialect.OpenQuote">
            <summary></summary>
        </member>
        <member name="P:NHibernate.JetDriver.JetDialect.SupportsLimit">
            <summary>
            Does this Dialect have some kind of <c>LIMIT</c> syntax?
            </summary>
            <value>False.</value>
        </member>
        <member name="P:NHibernate.JetDriver.JetDialect.SupportsLimitOffset">
            <summary>
            Does this Dialect support an offset?
            </summary>
        </member>
        <member name="P:NHibernate.JetDriver.JetDialect.SupportsVariableLimit">
            <summary>
            Can parameters be used for a statement containing a LIMIT?
            </summary>
        </member>
        <member name="T:NHibernate.JetDriver.JetDriver">
            <summary>
            Implementation of IDriver for Jet database engine.
            Because of the weird JOIN clause syntax, this class has to translate the queries generated by NHibernate
            into the Jet syntax. This cannot be done anywhere else without having to heavily modify the logic of query creation.
            The translations of queries are cached.
            </summary>
            <remarks>
            <para>
            Author: <a href="mailto:lukask@welldatatech.com">Lukas Krejci</a>
            </para>
            </remarks>
        </member>
        <member name="M:NHibernate.JetDriver.JetDriver.CreateConnection">
            <summary></summary>
        </member>
        <member name="M:NHibernate.JetDriver.JetDriver.CreateCommand">
            <summary>
            We have to have a special db command type to support conversion of data types, because Access is weird.
            </summary>
        </member>
        <member name="M:NHibernate.JetDriver.JetDriver.FinalizeJoins(NHibernate.SqlCommand.SqlString)">
             <summary>
            Jet engine has the following from clause syntax:
            <code>
            		tableexpression[, tableexpression]*
            </code>
            where tableexpression is:
            <code>
            		tablename [(INNER |LEFT | RIGHT) JOIN [(] tableexpression [)] ON ...]
            </code>
            where the parenthesises are necessary if the "inner" tableexpression is not just a single tablename.
            Additionally INNER JOIN cannot be nested in LEFT | RIGHT JOIN.
            To translate the simple non-parenthesized joins to the jet syntax, the following transformation must be done:
            <code>
            		A join B on ... join C on ... join D on ..., E join F on ... join G on ..., H join I on ..., J
            has to be translated as:
            		(select * from ((A join B on ...) join C on ...) join D on ...) as crazyAlias1, (select * from (E join F on ...) join G on ...) as crazyAlias2, (select * from H join I on ...) as crazyAlias3, J
            </code>
             </summary>
             <param name="sqlString">the sqlstring to transform</param>
             <returns>sqlstring with parenthesized joins.</returns>
        </member>
        <member name="M:NHibernate.JetDriver.JetDriver.TransformJoinBlock(System.String)">
            <param name="block">A string representing one join block.</param>
        </member>
        <member name="P:NHibernate.JetDriver.JetDriver.UseNamedPrefixInParameter">
            <summary>
            MS Access expects @paramName
            </summary>
        </member>
        <member name="T:NHibernate.JetDriver.JetJoinFragment">
            <summary>
            Jet engine does not support FULL JOINS.
            
            <p>
            Author: <a href="mailto:lukask@welldatatech.com">Lukas Krejci</a>
            </p>
            </summary>
        </member>
        <member name="M:NHibernate.JetDriver.JetJoinFragment.AddJoin(System.String,System.String,System.String[],System.String[],NHibernate.SqlCommand.JoinType)">
            <summary>
            Jet engine does not support full joins.
            </summary>
            <param name="tableName"></param>
            <param name="alias"></param>
            <param name="fkColumns"></param>
            <param name="pkColumns"></param>
            <param name="joinType"></param>
        </member>
    </members>
</doc>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect
Canada Canada
Ashutosh is an avid programmer, who “lives to code”. One can always find him busy seeking challenging programming assignments on various complex problems ranging from Data management, Classification, Optimization, Security, Network analysis, Distributed computing.

He started his programming stint with “C”; he has also worked on C++, Visual Basic, JAVA, Perl, FoxPro, PASCAL, Shell Scripting, and Perl. Currently, he is proficient and working on C#.

His area of interest includes Distributed Computing, Analytic and Business Intelligence, Large Enterprise System Architectures, Enterprise Content Management.

He is an advocate of Open source and likes to share solutions with open source communities like
1.Stack Overflow
2. nHibernate
.

Award's :
Prize winner in Competition "Best article of May 2008"

Articles :
Click to see my CodeProject Articles

Blog :
Share a solution | Explore the .NET world

Link'd :


His Favorite(s) :
nHibernate - The best ORM.
nHibernate Contributed Tools

Comments and Discussions