Custom Entity – Data Operation on Multiple Tables
1. In a case, where we are considering m2m, and it’s required to add a new entity record in the m2m table, an obvious case comes, where we create and save the entity first and then we add that entity in the m2m table. For example, when we add a new book to an exiting author’s book list, we first create a “Book” object and save it, and then we add this book to the author book list thru a static method. However, in that case, we might have to consider database server side or application level (ex: COM+) transactions, where the whole operation will be rolled back for any unsuccessful process in the full operation path.
2. While attaching the m2m table to a o2m table, in this case we have to perform data operations in two separate tables. We can do this either in the stored procedure layer at one time, where all required data will be passed thru stored procedure parameters and the stored procedure will perform operations in the separate table. Or this can be done separately from the application layer, which is useful, when we contain a very common format for CRUD operations for each and every database table in the stored procedure layer (generally when we generate CRUD stored procedures).
Anonymous comments are disabled
About joycsc
Mohammad Ashraful Alam is a Software Engineer, who is dedicated to Microsoft .NET based development. This Bangladeshi national is involved with project management and development of several US based software projects from his country. Already he has managed and developed 15 software projects, which are being used by several users of different counties, such as USA, Canada, Australia, and Bangladesh. While developing and managing a team, he contains and maintains a set of well defined engineering practices developed by him and other online developer community. Beside software development, he has also written several technical articles and research papers published by IEEE Computer Society and many other worlds recognized publishers. When not engaged with technical stuffs, he likes to pass time with his friends, and family members, listens music or watches TV.