Timeline for How to implement DRY principle when using 'using' keyword?
Current License: CC BY-SA 3.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 29, 2013 at 14:03 | comment | added | Paul C | @WeekendWarrior Is using (in this context) still a more unknown "convenient syntax"? Why it's so nice to use =) | |
| Aug 26, 2011 at 13:15 | comment | added | back2dos | @Saeed: Post updated. | |
| Aug 26, 2011 at 13:14 | history | edited | back2dos | CC BY-SA 3.0 | added 507 characters in body |
| Aug 26, 2011 at 13:02 | comment | added | user | @Saeed: That's when you look into dependency injection. But that seems to be to be quite different from the case as stated in the question. | |
| Aug 26, 2011 at 13:00 | comment | added | Anonymous Apple | Having "using" here closes the data context so lazy loading is not possible outside of these methods. | |
| Aug 26, 2011 at 12:29 | comment | added | Saeed Neamati | But @back2dos, there are many places where we use using (CustomTransaction transaction = new CustomTransaction()) code block in our code to define the scope of a a transaction. That can't be bundled into a single object and in every place you want to use a transaction, you should write a block. Now what if you want to change the type of that transaction from CustomTransaction to BuiltInTransaction in more than 500 methods? This seems to me to be a repeating task and a breach example of DRY principal. | |
| Aug 26, 2011 at 12:22 | history | answered | back2dos | CC BY-SA 3.0 |