I have created 3 Projects PL(web application) BL(Class Library) DA(Class Libraray).Then I added References From PL to BL Then from BL to DA
Then I try to add From DA to BL then I got an error.so I added reference of BA Dll in to DA.Then it worked fine.after do some coding I
clean the solution and try to rebuild then I got lots of errors .I try to build project one by one .but it didnt work.then I comment all the work what I have done and rebuild it.
Please can any body Explain me how to avoid getting errors when we are doing Celan the solution and build .
I think you are getting into "Circular file reference". what that mean both project need each other to compile and interdependant. It wise to avoid this type of referencing. so avoid call BL from DA.
I think you are getting into "Circular file reference". what that mean both project need each other to compile and interdependant. It wise to avoid this type of referencing. so avoid call BL from DA.
Yes of Course
So Could Please Explain me this code how to do I pass Employee Object in to DA project with out calling BL from DA because I don't know how to do that please explain me.
BL has a Class Employee
//BL--Project
class Employee
{
public string Name{get;set;}
public string Email{get;set}
}
class CallDA
{
public void InsertEmployee(Employee emp)
{
Data da=new Data();
da.Insert(emp);
}
}
//DA--Project
class Data
{
public void InsertEmployee(Employee emp)
{
//Save emp in to database
}
}
Simply add a project as EmployeesEntitiy and move properties. Create another project for BL(remove properties from BL). Lastly create a project for CallDA. when passing data, use EmployeesEntitiy object.
refer EmployeesEntitiy.dll toBL and DA.
refer CallDA.dll to BL layer.
Marked as answer by _Niroshan_ on Jan 28, 2013 10:42 AM
For simplicity's sake, you can pass the two parameters Name and Email instead of one Employee class.
//BL--Project
class Employee
{
public string Name{get;set;}
public string Email{get;set}
}
class CallDA
{
public void InsertEmployee(Employee emp)
{
Data da=new Data();
da.Insert(emp.Name, emp.Email);
}
}
//DA--Project
class Data
{
public void InsertEmployee(string name, string email)
{
//Save emp in to database
}
}
_Niroshan_
Member
3 Points
10 Posts
3-Tier Architecture issue
Jan 25, 2013 01:32 AM|LINK
Hi all
I have created 3 Projects PL(web application) BL(Class Library) DA(Class Libraray).Then I added References From PL to BL Then from BL to DA
Then I try to add From DA to BL then I got an error.so I added reference of BA Dll in to DA.Then it worked fine.after do some coding I clean the solution and try to rebuild then I got lots of errors .I try to build project one by one .but it didnt work.then I comment all the work what I have done and rebuild it.
Please can any body Explain me how to avoid getting errors when we are doing Celan the solution and build .
Please Help.
Thanks.
CruzerB
Contributor
5399 Points
1098 Posts
Re: 3-Tier Architecture issue
Jan 25, 2013 01:50 AM|LINK
Hi,
http://msdn.microsoft.com/en-us/library/f3st0d45(v=vs.100).aspx
Use "Add Project" reference instead of browse the .dll files.
My Technical Blog
_Niroshan_
Member
3 Points
10 Posts
Re: 3-Tier Architecture issue
Jan 25, 2013 01:53 AM|LINK
Yes That is the way I have done.but Cant Clean the Solution and and Build again.
cnranasinghe
Star
8885 Points
1798 Posts
Re: 3-Tier Architecture issue
Jan 25, 2013 01:57 AM|LINK
I think you are getting into "Circular file reference". what that mean both project need each other to compile and interdependant. It wise to avoid this type of referencing. so avoid call BL from DA.
_Niroshan_
Member
3 Points
10 Posts
Re: 3-Tier Architecture issue
Jan 25, 2013 02:08 AM|LINK
Yes of Course
So Could Please Explain me this code how to do I pass Employee Object in to DA project with out calling BL from DA because I don't know how to do that please explain me.
BL has a Class Employee
//BL--Project class Employee { public string Name{get;set;} public string Email{get;set} } class CallDA { public void InsertEmployee(Employee emp) { Data da=new Data(); da.Insert(emp); } } //DA--Project class Data { public void InsertEmployee(Employee emp) { //Save emp in to database } }cnranasinghe
Star
8885 Points
1798 Posts
Re: 3-Tier Architecture issue
Jan 25, 2013 03:57 AM|LINK
Hi Niroshan,
I think you have done everything, i assume that you have 3 projects
1) one for Employee entities( properties)
2) BL and 3) DL
Do not refer BL dll in DL project, if so remove it, But Employee entity dll (property class) need to be reference in BL and DL.
class CallDA{ public void InsertEmployee(Employee emp) { Data da=new Data(); da.InsertEmployee(emp); } }_Niroshan_
Member
3 Points
10 Posts
Re: 3-Tier Architecture issue
Jan 26, 2013 04:36 AM|LINK
i have created 3 projects
1)Presentation Layer-aspx pages
2)BL -Employee Properties class and Class CallDA ( this class is use to access Data Class in side the DA project )
3)DA-this project is use to store data in to database .this project contains Data Class
I'm sorry I dont understand Could you please explain more .
Class CallDA and Class Employee(properties) is in the same BL project so I dont understand how to do it.
cnranasinghe
Star
8885 Points
1798 Posts
Re: 3-Tier Architecture issue
Jan 28, 2013 01:16 AM|LINK
Simply add a project as EmployeesEntitiy and move properties. Create another project for BL(remove properties from BL). Lastly create a project for CallDA. when passing data, use EmployeesEntitiy object.
refer EmployeesEntitiy.dll toBL and DA.
refer CallDA.dll to BL layer.
xmione
Member
344 Points
80 Posts
Re: 3-Tier Architecture issue
Jan 28, 2013 02:22 AM|LINK
Hi Niroshan,
For simplicity's sake, you can pass the two parameters Name and Email instead of one Employee class.
//BL--Project class Employee { public string Name{get;set;} public string Email{get;set} } class CallDA { public void InsertEmployee(Employee emp) { Data da=new Data(); da.Insert(emp.Name, emp.Email); } } //DA--Project class Data { public void InsertEmployee(string name, string email) { //Save emp in to database } }But if you want a cleaner architecture, less dependencies or a more loosely-coupled architecture, I recommend you try the Onion Architecture, see this link => http://jeffreypalermo.com/blog/the-onion-architecture-part-1/ . It is a four - part tutorial about Onion Architecture but if you want to see the code it's in part 4. Here's the link to the sample code https://bitbucket.org/jeffreypalermo/onion-architecture.
Regards
__________________________________________________________
Please mark as Answer if this solves your problem.
_Niroshan_
Member
3 Points
10 Posts
Re: 3-Tier Architecture issue
Jan 28, 2013 10:44 AM|LINK
Thanks for the Information That is a good one ..