i am working first time on the three layer architecture, I've created three Projects in one Solution, Project one is named BLL, second is named DAL and third one is names Model, I've Created interface in Model, now want to Create Business Logics in BLL and want to connect it to the DAL where I've connected my Data Base.
For this Purpose I've added Reference of each Project With other like I've Added Reference of BLL in Model and Added reference of BLL in DAL.
now for the time i've created a class is DAL in which i've Connected my DB and have alos Created a Windows Form in Model,
Now my questions are
1)how can I access classes of DAL in BLL and BLL's in Model
2)and which logic I've to create (in BLL) to Access Database through BLL
the class in which I've connected DB is
DB.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient();
namespace WindowsFormsApplication3
{
class DB
{
public void fnc_ConnectoToDB(ref SqlConnection cn)
{
string strConnectionString = null;
strConnectionString = @"Data Source=AHSANMUGHAL;Initial Catalog=SurveyBuilder;User ID=sa;Password=ahsan";
cn = new SqlConnection();
cn.ConnectionString = strConnectionString;
cn.Open();
}
public void fnc_CloseCn(ref SqlConnection cn)
{
if (cn.State == ConnectionState.Open == true)
{
cn.Close();
}
}
}
}
i know this is bit confusing question but I hope you guys will understand it and will ans ASAP