--
You received this message because you are subscribed to the Google Groups "ravendb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
I'm the opposite of many users here (and to what Ayende advises) I never expose RavenDB to my application. RavenDB usage is always buried at the lowest level so I can do full test first development without touching anything related to a persistence store. I follow the rule of always defer the database and other similar dependency details.
Note that just because i said this doesn't mean have FooService : IFooService everywhere, interfaces are rarely needed, generally public virtual is all that's needed for testability. Also using the repository pattern is no excuse for letting feature/scope creep happen that leads to glaring SRP violations. Repositories are great places for removing boiler plate code such as handling mapping, user audit tracking, entity validation (as opposed to business validation) etc. Raven provides many hooks itself for these AOP-ish actions however I feel these are first class application knowledge and should not be buried into the persistence store configuration.
Aka I try to avoid everything magic at this point.
--
My own devil's advocate play:"Mapping can be very easily handled with AutoMapper."I've removed about as much of this code as I've written in projects. Now all the mapping code is "somewhere else", possibly even in another assembly. I'd either rather have the "flavored function" do this mapping or have the view model do this mapping. As models evolve, I've seen my fair share of bugs of "oops, I forgot to change whatever in the "auto" mapping code and the Mapping Assert didn't catch it and the "my gosh, if you remove auto mapper the performance doubles".Hand mapping is very boring code to write, but it's also dead obvious what's going on 6 months later.
"--
--
It's a worth while discussion to have and doesn't need to end with hearts and minds changed :)The basic problem having hard dependencies on things outside of your control and/or things that can change (not a judgement of RavenDB at all).Each time you take a hard dependency on something, you have to ask yourself, what does it cost the product / project / my sanity if it fails to do its job, stops being supported, becomes too expensive, becomes redundant or is superseded.It's not about rewriting those queries. You have to do that no matter where they are written. It's about rewriting all the code that sits above and around the queries.If your software is a MVC web app, your DB access is in your controller. Happy days that's one file per page (probably) that needs to be reviewed and changed.If you have a enterprise application where there are many moving parts and database access is spread over many parts, like web interface, service interfaces, reporting functions, background running tasks, integration with other running systems and so on, it could well be that your particular DB interfaces (e.g. IDocumentStore) are passed all around the place for things to do their job.
I recommend using the assertion as well, but still expect issues. :-)