Skip to main content
16 events
when toggle format what by license comment
Aug 6, 2016 at 15:12 comment added Xavier Peña @t3chb0t Thanks, I'll be waiting for the edit. I will unmark the "answered" temporary so other people is not mislead by the tag until the code does what it was intended to do. Please notify me via comments so I can read it and mark it as answered.
Aug 6, 2016 at 15:05 comment added t3chb0t @XavierPeña I think you're right. I confused unity with something else but now I see it's a DI container so it actually doesn't do anything useful there now. There is a lot to read about it 3 - Dependency Injection with Unity I'll look at it another time. This is quite interesting so I'll post another edit when I get how it actually works.
Aug 6, 2016 at 14:50 comment added Xavier Peña @t3chb0t Thanks for the elegant implementation, specially inheriting from ConnectionBase and putting all the verbose stuff there. At the same time, I have a problem understanding how _unityContainer interacts with the code... wouldn't the code work exactly the same if all three lines that interact with UnityContainer(the declaration + 2 lines in the constructor) were removed from the code?
Aug 6, 2016 at 14:37 vote accept Xavier Peña
Aug 6, 2016 at 15:11
Aug 6, 2016 at 14:24 comment added t3chb0t @XavierPeña see the edit. I hope it helps ;-]
Aug 6, 2016 at 14:23 history edited t3chb0t CC BY-SA 3.0
added 3410 characters in body
Aug 6, 2016 at 13:53 comment added Xavier Peña @t3chb0t I am free to change it as long as I understand the core concepts, and at this point my confidence in that is not very high. That's why I was asking. Other than that, in the pastebin link I was trying to implement it without the verbose _connection.Connection.Open(). If you post the proper changes (specially regarding the actual use of UnityContainer) I would like to mark the question as answered. This my last version of the code for UnityConnection, in case it helps: pastebin.com/vpjhrfzx
Aug 6, 2016 at 13:45 comment added t3chb0t @XavierPeña I guess so. I'm not a unity expert but you're free to write anything that works for you inside the constructor :-] It should just demonstrate the general model and how it can be encapsulated. I'm sorry it didn't work the first time.
Aug 6, 2016 at 13:42 comment added Xavier Peña @t3chb0t I'm sorry, I've been playing with the code and I've suddenly realized that your _unityContainer, despite registering the Connection, it actually does nothing (I think?). Could it be solved with a simple this.Connection = _unityContainer.Resolve<IDbConnection>(); in the last line of the UnityConnection constructor?
Aug 5, 2016 at 12:59 comment added Xavier Peña @eurotrash I liked t3chb0t answer, and I wanted it to match the requisite you highlighted. I've proposed a possible solution in this pastebin: pastebin.com/0ETTpcWc (instead of creating a new answer), so if t3chb0t is OK with it / wants to improve it, it can be added to the original answer.
Aug 5, 2016 at 4:06 comment added t3chb0t @eurotrash oh, you're right, I need to fix this later.
Aug 5, 2016 at 4:03 history edited t3chb0t CC BY-SA 3.0
added 32 characters in body
Aug 4, 2016 at 10:32 comment added 404 But to do anything on the connection you would have awkward syntax e.g. _connection.Connection.Open(). If IConnection does nothing but contain an IDbConnection then you might as well use IDbConnection directly imo.
Aug 3, 2016 at 18:53 history edited t3chb0t CC BY-SA 3.0
deleted 26 characters in body
Aug 3, 2016 at 18:47 history edited t3chb0t CC BY-SA 3.0
added 97 characters in body
Aug 3, 2016 at 18:30 history answered t3chb0t CC BY-SA 3.0