So I am fairly new MVC4 and many patterns are new to me.
However the one thing I am curious about is best practice about release/debug modes. There are a bunch of things for me that differ between live and debug mode and I would like for all of them to be automatic so I don't need to change anything to publish.
So for instance I have done like this in my repo (domain project) public class EFAccountRepository : IAccountRepository { private EFDbContext _context;
public EFAccountRepository()
{
#if DEBUG
_context = new EFDbContext("name=Debug");
#else
_context = new EFDbContext("name=Live");
#endif
}
and like this in my DI (webui)
#if DEBUG
EFDbContext efcontext = new EFDbContext("name=Debug");
#else
EFDbContext efcontext = new EFDbContext("name=Live");
#endif
Or would it be smarter to simply have
EFDbContext efcontext = new EFDbContext("name=MyApp");
And then change with web.config transform what MyApp means?
Any other tips of automating debug/release-publish is warmly welcomed.