Well, I'm gonna tell you about a few pitfalls with your approach, and how I generally do it.
Pitfalls
Your DAL-instance property seems like a smart, weird way of doing a singleton. You should remember that requests to your webserver can be handled asynchronously, so if your Activator.CreateInstance call will take some time, this could result in some problems.
Your BLL-layer suffers from the same problem, I guess. It's better to do this kind of initialization on the application startup event (can't remember the exact name).
What you are basically using here is the DI-principle and the repository pattern. Both are great, and will allow for modifications and testing, however, since your abstract class will be in the DAL and your BLL-methods will call the DAL-classes, your BLL needs to know about the DAL. This can be a problem. You could create an intermediate library with an interface to your abstract class instead.
What I typically do
I really don't like "layers" in an application, since it's often hard to distinguish between different types of functionality, and in which direction they should know about other layers. I use another approach, which I'm not really sure is dubbed anything, but I call it the dependency circle :) Basically, it's like a dart board, where the innermost assemblies will know nothing about the outermost.
In your typical blog-engine web-app, I'd do something like this:
BlogEngine.Core
holds POCO-entities of various items (Post
, User
, Comment
, whatever) and also various interfaces to services. These services can include IEmailService
, IBlogRepository
, IUserManagement
, etc. etc... I now make a BlogEngine.Infrastructure.Persistence
assembly, which knows about the .Core
and implements IBlogRepository
. I do the same for all other services.
Now - Your BlogEngine.Web
only needs to reference your .Core
assembly and an IoC-framework assembly that will take care of all your dependencies. If I want to update a post, I can do myIOC.GetInstance<IBlogRepository>().SaveOrUpdatePost(newPost);
.
Let's say you want to notify authors when people post a comment on their blogs. You could implement this logic in .Core
as an Notifier
-class. This class could resolve the IEmailService and then send whichever email you need.
Point being: You got a core, which should never change with your domain. Then you got infrastructure assemblies which know only about Core. You got your web-app which know about Core and the IOC-framework - And you got your IOC which knows about everything, and is allowed to do so :) If you need to make changes, chances are that it's in the infrastructure assemblies and so you only need to update your IOC settings and implement which
I hope this makes sense, if not, please leave a comment and Ill try to explain further :)
Good luck