I know this may be a duplicate question. But i never found a correct explanation that a beginner like me can understand.
My question is "What all things we can do inside Business Logic Layer". I have done 3 tier architecture projects. But I used BLL only to pass values between UI and Data Layer.
But whenever i attend an interview they asks me what all things you do inside BLL.
Please help me to understand the correct use of BLL.
Please provide little bit of sample code if you can.
This question may get deleted because it is not in the format that stackoverflow likes.
BLL handles the business logic such as how to do a specific formula or execute a workflow. It will typically contain rules that a company wishes to implement.
The data layer typically just gets data from the database, file or some other data source and doesnt do any further modification to it. It is usually the business layer that loads the data into some kind of business relevant class/object. The BLL may also modify the data from data layer before it passes it to the UI layer. The UI layer only does simple validations and renders the data it gets from the BLL
For eg.
in the datalayer
you could have a function
public DataSet GetAllAccounts()
{
DataSet ds;
//Some sql code to read out the sql data using datareader and dataadapter;
return ds;
}
and in the business layer you could have
public List<Account> GetAllAccounts()
{
DataSet ds = DataLayerClass.GetAllAccounts();
return (from Tab1 in ds.Tables[0] select new Account(){AcctNum =Tab1.AcctNum, Name =Tab1.Name}).ToList();
}
As you can see, Account is a business specific object whereas DataSet is something that is relating to the db and doesnt care about business or any business rules.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With