Contract separation

Apr 21, 2015 at 11:06 AM
Is it possible to create a separate dll containing the entity interfaces / contracts without all the VITA stuff attached to it? That way I can use the interfaces when designing other libraries without the need of including the VITA assemblies.
Apr 21, 2015 at 5:34 PM
Edited Apr 21, 2015 at 10:24 PM
You can try the following: define all interfaces without VITA attributes, work with them in your biz code, then create 'db model' assembly referencing your interface definitions and VITA. In this bridge assembly inherit all interfaces and decorate them with VITA attributes at entity level; PK and Index attributes allow you to put them at entity level (vs property) and reference the property name(s) in parameter. And register all these derived interfaces in VITA entity model. The biggest problem I see is the entity references - (like IBook.Publisher); try to 're-declare' such properties in derived interfaces with 'new' keyword, but I'm not sure how well it will work with your other stuff
Apr 23, 2015 at 3:41 PM
Followed your advise, but haven't been able to run through all of my code. Got stuck on the IoC component I use. It doesn't let me register the derived interfaces decorated with the VITA stuff. Which does of course makes sense since an IoC tries to instantiate a class implementing a certain interface. Damn, I was so keen on using VITA. It looks quite promising, I would say. Any (miraculous) advise on this would be very welcome.
Apr 23, 2015 at 6:22 PM
my advice would be - go 'easy' on using IoC container. I have hard time imagining scenario when you want IoC automatically create an instance of an entity. An entity is a heavy context-bound object, it can't be instantiated 'from the air' by IoC. So if you want IoC - ok, use it but for other things.
Apr 24, 2015 at 8:07 AM
Tx very much for your quick responses. And, keep on the good work with VITA. I like it.