Contents tagged with ADO.NET

  • Wrapping multiple calls to SaveChanges() in a single transaction

    When you make any additions, modifications and deletions to an Entity Framework DbSet and call SaveChanges(), EF starts a new transaction and executes all the INSERT, UPDATE and DELETE operations inside that newly created transaction. If the call to SaveChanges() succeeds the underlying transaction is committed, otherwise the transaction is rolled back. In some cases you may want that multiple calls to SaveChanges() be executed in the same transaction. Luckily, Entity Framework 6 provides an easy way to accomplish the same.

  • Introduction to Entity Framework Code First

    Entity Framework (EF) allows you to program against a model instead of dealing with a database directly. In EF 4.0 (that ships with .NET 4.0) you typically design a model from an existing database visually, using a designer provided for that purpose. EF 4.1 builds on top of what EF 4.0 provided and allows you to create models directly at code level. That means instead of creating any database and then using a designer to define models, you create plain .NET classes and then use EF 4.1 techniques to make them EF models. This approach is referred as Code First because you focus on the source code of the model classes first. Once the models are ready Code First can also generate database tables out of those model classes. In this tutorial you will learn the basics of developing an application using Entity Framework Code First.

  • BinaryIntellect Code Generator (BETA) released

    One of the things I like about software development is the ability to automate monotonous tasks. Few weeks back I needed a free code generator for generating typical insert, update, delete, select all and select by Id kind of stored procedures and classes. Believe it or not but there are developers who manually code these stored procedures and classes. There are many gode generation tools available today. Some are free and rest all are commercial. In the past I used one of the popular FREE tools. But it seems that the tool no longer exists as FREE. The company has removed its mention from their home page. Moreover my requirements was such that I could not have used the code AS IS. So there was no option but to write my own tool :-). As a result I wrote BinaryIntellect Code Generator. It is absolutely FREE to use Currently it is being released as BETA. Some features will be added in near future. If you can spare some time running it on some test database and give your feedback including bugs, error or features that will be great. I can include them in the final version.