Hi,
I am fairly new to .net and am creating a web app for learning purposes. I have a DAL with non static methods in it. My question is, how should i be accessing these methods in the business layer?
I'm not sure if this is a good or a bad way but currently i use this class to create instances of the DAL methods:
public DataAccess
{
public static T GetInstance<T>(Type type)
{
return (T)Activator.CreateInstance(type);
}
}
And i use the instances like this in my DLL:
public void Save(Article article)
{
ArticleDAL art = DataAccess.GetInstance<ArticleDAL>(typeof(ArticleDAL));
art.Save(article);
}
Any improvements or recommendations?