Hello,
i've found a bug on the last release of DBLinq when i try to update an
entity using Oracle and ODP.NET.

ODP.NET have a problem with OracleCommand and its parameters, the
command don't find parameters by ID but only by Name, so when we try
to update a field on a table and dblinq generate the sql command with
the parameters the ExecuteNonQuery don't through and don't update
nothing.

I've find a solution by setting up a property of OracleCommand that
specify to find parameters ByName.
I've create a static class like this:
    public static class DBCommandExtender
    {
        private const string DBOracleType =
"oracle.dataaccess.client.oracleconnection";

        public static void SetDefaultProperties(IDbCommand command)
        {
            if (command == null)
                return;

            if (IsDBType(command.Connection, DBOracleType))
                SetOracleProperties(command);
        }

        private static bool IsDBType(IDbConnection connection, string
dbtype)
        {
            return
connection.GetType().FullName.ToLower().Equals(dbtype);
        }

        private static void SetOracleProperties(IDbCommand command)
        {
            System.Reflection.PropertyInfo pBindByName =
command.GetType().GetProperty("BindByName");
            if (pBindByName != null)
                pBindByName.SetValue(command, true, null);
        }
    }

and in file
DbLinq.Data.Linq.Database.Implementation.DatabaseContext.cs at line
119 after:
IDbCommand command = Connection.CreateCommand();
've added this line:
DBCommandExtender.SetDefaultProperties(command);

So ODP.NET find the right parameter  during the ExecuteNonQuery
method.

I don't know if it's the best way to solve the bug but it's work fine
for me.

-- 
You received this message because you are subscribed to the Google Groups 
"DbLinq" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/dblinq?hl=en.

Reply via email to