Optimistic Concurrency & Joins in Code Generation RRS feed

  • Question

  • We are trying to make a case for CodeGen.  However there are a few scenarios I'm trying to stub out and make a case for.  Currently a Typed DataSet I believe handles the following out-of-box that I need to be able to have a way to handle this cleanly in the Code Generated Templates and be able to explain these in simple terms to the other developers as they are not experienced much in Custom Objects since they are using Typed DataSets:


    1) Optimistic Concurrency -  and how to check for it and handle it or do you not check for that or assume that model at all with custom classes & Codegen?

    2) How to handle join situations.  For example if you have a GridView that you want to click Update and you know you need to update not just one entity.  It's not as clear as just calling Update on lets say Customer and some Orders for that Customer in a DataGrid or something.  That Grid is bound from a Generic list call from your BL and  your BL called a DL method that returned that generic collection you are binding to.  And so then on save of the DataGrid, you need to update several other Entities related to a Customer, not just customer.  Would this ever happen and need to be handled?  how?  The stupid Typed DataSet handles this stuff for you but is very inefficient and all done in a black box

    And if you ask me why I don't like Typed DataSets I'll have to literally hang you if you don't know the answer to that question.

    Wednesday, September 24, 2008 2:52 AM

All replies

  • What do you mean by CodeGen?

    It sounds like what you're talking about is ORM, the mapping of objects to relational databases. There are a wealth of options out there, most of which take care of all the concerns you raise (persisting an object graph (not just the entity itself), loading related collections, tracking changes, and concurrency control). Look into NHibernate, LLBLGen, the younger LinqToSql and EntityFramework, and so on. Find an approach you like, and learn it. You'll never look back.

    They're all a better solution to either using datasets (typed or otherwise), rolling your own code, or using code generation.
    Wednesday, September 24, 2008 3:39 PM