0

I am having an application in .NET that uses Entity Framework 4. I am using the DB2/400 as my application backend. I am able to make queries and read successfully from the database. However on any other operation (such as insert/update/delete), I am getting errors. I found the answer at http://www.ibm.com/developerworks/forums/thread.jspa?messageID=14222306 which stated that my DB2 client driver was not configured for transactions. However, under /sqllib/cfg folder there is no db2cli.cfg file present (or anywhere else on my computer) Also, I am able to modify the tables from the green screen/java application. Here is one of my methods :

using (var context = new Data.SchemaEntity()) {
            string sql = "select * from schemaname.tablename where FLD='V2'";
            var rows = context.ExecuteStoreQuery<CUST>(sql, null);
            CUST c = rows.First(); // This is giving me the correct data

            if(c.EntityState == System.Data.EntityState.Detached)
                context.CUSTS.Attach(c);
            context.CUSTS.DeleteObject(c);

            context.SaveChanges();

        }

My questions are :

  • Should I go for another versions/ installation of DB2 express-C that installs the .NET driver/provider.
  • Can I use any other approach for data persistence within the entity framework (for example in jpa/hibernate we can use explicit Transactions).

If you've got any ideas (That I can possibly try, please do mention here)

Mike Wills
  • 20,959
  • 28
  • 93
  • 149

1 Answers1

0

I haven't had much luck with using entity framework with the i. Typically, I have just used the ADO.NET driver from IBM i Access. Sorry I don't have a better answer for you. I have been looking for months for a EF driver for the i.

Mike Wills
  • 20,959
  • 28
  • 93
  • 149
  • Still searching? I am also bound to iSeries and building "fat" ado.net methods for a simple select... – e4rthdog Oct 01 '13 at 05:47
  • Yep, still searching. There is one package you can buy that looks like it _might_ work with EF, but I haven't seen 100% one way or another. – Mike Wills Oct 02 '13 at 14:05
  • 1
    i found my solution..i am using DAPPER micro-ORM Check it out..If you want EF provider you have to go with DBConnect with is a payware product of IBM – e4rthdog Oct 02 '13 at 15:01