Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Please can anyone help me to understand my project. I am unable to access connString from web.config file to my BO and DA layers which are physically separated as class library projects in the same solution. Though i have read many articles but I can't understand such architecture. I have CRUD methods and Entity Classes in DA layer. All I want is to validated DB method in DA only.
suppose to get my conString if i need to write it in BaseClass in a fashion like below. Need to declare Constructors for connStr with argument and without arguments as connectionString. And a friend Property. I dont know either class should be private or public but such method i have seen in DNNuke site architecture. Please if you can help me in this way then sir i would be very much thankful. I tried But alot of errors like "The format is incorrect" or "Invalid connection String...."
Please could you favour me how to access my classes from one layer to another.Thank you
Posted

1 solution

You should construct the DAL classes to have a constructor that takes a connection string and preferably a base class to control it.

public abstract class MyDALBase
{
  public MyDALBase()
  {
    // Set default connection string
  }

  public MyDALBase(string connString)
  {
    ConnectionString = connString;  
  }

  protected string ConnectionString{get; private set;}
}

public class MyDAL : MyDALBase
{
  public MyDAL() : base(){}
  public MyDAL(string connString) : base(connString){}
}


You should look at frameworks like the Enterprise Library Data Access Application Block. DNN is not a good implementation for anything, IMO
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900