Architecture :: How To Pass Data Between Layers

Jul 6, 2010

I have three layers like UI, business and data access in my asp.net web application project. If I pass say a company code from the UI to the business to the data access and I query the company details like company name, address, phone etc from the database using sqlhelper executedataset() which wil return me a dataset. Then how do I pass these company details back to the UI layer. Is it correct to just pass the datatable object to the business and UI.

View 6 Replies


Similar Messages:

Architecture :: Using Linq To SQL, What Layers Should Use

Nov 18, 2010

I want to use Linq to SQL in my web projects. I mostly work in small and medium size projects. Please guide me what layers I should use ?

Previously I was using DAAB and was using 4 layers (business objects, business logic layer, data access layer and user interface).

View 5 Replies

Architecture :: Modelling Application Layers?

Jan 26, 2010

I'm trying to create my first Asp.Net application from scratch. Tried to create this post in some of the other forums but I couldn't find a better place.

So, as the title says, I'm having trouble trying to model my application. I'm like an OOP newbie. I'll show my classes first and then I'll write my questions.

Model Layer

public class User
{
private int id;
public int Id { get { return id; } set { id = value; } }
private string login;
public string Login { get { return login; } set { login = value; } }
private string password;
public string Password { get { return password; } set { password = value; } }
}
Data Access Layer
public class BasicDAL
{
private SqlConnection connection;
//>>Returns a new connection to the database
public SqlConnection GetConnection()
{
//>>If connection is active close it before starting a new one
if (connection != null)
if (connecion.State != ConnectionState.Closed)
connection.Close();
connection = new SqlConnection("MyConnectionStringHere");
return connection;
}
}
public class UserDAL : BasicDAL
{
//>>Insert a new user
public void Insert(User user); { /* Insert into DB */ }
//>>Authenticate user login with its password
public void Authenticate(User user); { /* Authentication code here */ }
}
Business Logic Layer

[Code]....

So, model layer is pretty simple. Just a user representation. On the Data Access Layer I have a basic class with a GetConnection method. All DAL classes will extend this one.

My first problem lies on Business Logic Layer. With the above scenario, I've placed the same methods that I placed at the DAL. BLL methods would call DAL. As simple as that but I believe It is not the best way to do it, is it? How can I improve those classes?

Also, I have to "try..catch" blocks. That's because I can't find good places for it. I mean, if I place a try..catch on GetConnection method, for instance, how my ASPX page would get this error? How my ASPX page can tell the difference between "database offline" and "sql syntax error" when executing "userBll.Insert(newUser);".

My problem is mainly placing the exception handlers. I understand I would probably have to change return type of some methods. I didn't change because I believe that will have something with the exception handlers.

Btw, please assume I can't use TableAdapters and stuff like that. I would like to create all layers by myself.

View 3 Replies

Architecture :: Dropdownlist Values And Layers In Application?

Mar 13, 2010

Here is the scenario.

Every project has a Supervisor.

When I select the supervisor for a particular project, I'm using a dropdownlist.Table is like this

ProjectId | SupervisorId | ......
--------------------------------------

1 | 1

In my application, I'm binding a Collection of Supervisor type, which I'm feeling that it is an additional overhead. Becuase I only want his ID. So binding an object collection to the dropdown which seems no worth.

View 5 Replies

Architecture :: Entity Framework With 3 Layers Design

May 19, 2010

I am thinking to use entity model as DAL, how should I create the BLL then? What kind of datasourceobject should I use in the asp pages?

I am looking for best practice to use Entity framework 2 in the three layers design. I had experience at dataset with three layers design.

Should I use objectdatasource at the pages for gridviews? My guess is that entitydatasource by passed the BLL which is not good, so the only option left is the objectdatasource.

Could and should my BL object inherit those entity model in the DAL, so I dont need to recreate their object's property?

View 4 Replies

Architecture :: Validation, Service Layers And Testing?

Dec 23, 2010

I have a quick question in regards to testing my validation. I have been looking through a few MVC examples and have noticed the 'Validating with a Service Layer' tutorial which is pretty nice. It discusses how to abstract your code out etc..My question is, that they have validation occuring in the service layer, if errors occur, the error + message then gets added to a model state dictionary.Now i want to test my model to make sure my business rules are being applied to it, but with this approach, for starters, the Validation method is not in the interface. Now, if the validation method was in the interface, during testing you would have to re-implement the validation on the testing side.Am i missing somthing? Where should your validation code go? I feel like it should go in the model, but then i have to track the errors on the model side.

View 1 Replies

Architecture :: Inherited DTOs, How To Implement The Layers Facade, Bll And Dal?

Feb 18, 2010

I doubt how to implement the layers
FACADE, BLL and DAL, using
DTOs specialized ..
where:

public class ClassA
{
private int _Test1;
public int Test1
{
get { return _Test1; }
set { _Test1 = value; }
}
}
public class ClassAB : ClassA
{
private int _Test2;
public int Test2
{
get { return _Test2; }
set { _Test2 = value; }
}
}
public class ClassAC : ClassA
{
private int _Test3;
public int Test3
{
get { return _Test3; }
set { _Test3 = value; }
}
}

In the database, there is the 3 tables, as described above.how do I implement the facade, bll and dal? only one class for 3 DTOs?

View 3 Replies

Architecture :: Design Which Have A Few Layers:Common, DataAccess, BusinessLogic,Operational?

Jun 24, 2010

It's appreciated if you could share your thought.I have seen a e-commerce website design which have a few layers:Common,DataAccess,BusinessLogic,Operational.In the Common layer,it includes all the classes with only attributes and properties,no methods nor data access codes here.

In the DataAccess layer,there is a class for each action per class in the Common layer.For example,

a class for the Select action of class A of Common layer,
a class for the update action of class A of common layer,
a class for the Select action of class�B of Common layer,
etc...
Is this a design I could use for a potential high trafic website?What's the pro and con of this design.

View 3 Replies

Architecture :: Pass Data From DAL To BLL And From BLL To PL?

Sep 29, 2010

I am developing an application for online examination system. It is 3 - tier application. I know how PL, BLL and DAL layers interact with each other but only one way. I meant, PL called BLL and BLL called DAL. However, recently I came across a scenario where I want to transfer a data from DAL to BLL and from BLL to PL or may be directly from DAL to PL.

I have "retrieve.aspx" page to reset forgotten password which contains a textbox and button. This page will ask Email address from user and when user hit the "Go" button, application will hit the database. If it finds the entered email address into a database, it will redirect to "questionanswer.aspx".

"questionanswer.aspx" contains a label, textbox and submit button. In the page load event of "questionanswer.aspx", application will show a security question (a fetched question from database related to entered email address) and ask user to fill an answer. On the click event of submit button, application again hit the database and authenticate the user, if the answer is correct it will redirect the user to password reset page. I can go up to fetching a question from database. But I do not know where to store it in DAL and how to pass it to PL where I can assign it to lable.text. I have 3 classes Users.cs, UserBAL.cs and UserDAL.cs. Retrieve.aspx.cs:

protected void btnGo_Click(object sender, EventArgs e)
{
Users PwdRetrieve = new Users();
PwdRetrieve.EmailAddress = txtEmailRetrive.Text.ToString();
Session["EmailAddress"] = txtEmailRetrive.Text.ToString();
UserBAL balPR = new UserBAL();
if (balPR.CheckEmailPR(PwdRetrieve))
{
Response.Redirect("questionanswer.aspx");
}
else
{
lblErrorMsg1.Text = ("We have not found an Email Address in our databse.");
lblErrorMsg2.Text = ("Please enter a valid Email Address.");
}
}
UserBAL.cs:
public bool CheckEmailPR(Users PwdRetrieve)
{
UserDAL dalPR = new UserDAL();
if (dalPR.CheckEmailPR(PwdRetrieve) > 0)
{
return true;
}
else
{
return false;
}
}
UserDAL.cs:
public int CheckEmailPR(Users PwdRetrieve)
{
int rows = 0;
using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString2"].ConnectionString))
{
string SP_CHECK_EMAIL = "CheckEmailForPasswordRetrival";
SqlCommand cmd = new SqlCommand(SP_CHECK_EMAIL, conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@Email", SqlDbType.VarChar).Value = PwdRetrieve.EmailAddress;
cmd.Parameters.Add("@rows", SqlDbType.Int);
cmd.Parameters["@rows"].Direction = ParameterDirection.Output;
conn.Open();
rows = Convert.ToInt32(cmd.ExecuteScalar());
rows = (int)cmd.Parameters["@rows"].Value;
conn.Close();
}
return (int)rows;
}
Questionanswer.aspx.cs:
protected void Page_Load(object sender, EventArgs e)
{
txtAnswer.Focus();
Users QuestionAnswer = new Users();
QuestionAnswer.EmailAddress = (string)Session["EmailAddress"];
UserBAL balQA = new UserBAL();
if (balQA.FetchQuestion(QuestionAnswer))
{
lblQuestion.Text = "Do not know how to assign a fetched question to this lable.";
}
else
{
lblErrorMsgQA.Text = ("Sorry! Please enter a correct answer.");
}
}
UserBAL.cs:
public string FetchQuestion(Users QuestionAnswer)
{
UserDAL dalQA = new UserDAL();
if (dalQA.FetchQuestion(QuestionAnswer) != null)
{
}
else
{
}
}
UserDAL.cs:
public string FetchQuestion(Users QuestionAnswer)
{
string question = string.Empty;
using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString2"].ConnectionString))
{
string SP_FETCH_QUESTION = "FetchQuestion";
SqlCommand cmd = new SqlCommand(SP_FETCH_QUESTION, conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Email", SqlDbType.VarChar).Value = QuestionAnswer.EmailAddress;
conn.Open();
SqlDataReader read = cmd.ExecuteReader();
while (read.Read())
{
question = read["tblSecurityQuestion"].ToString();
}
read.Close();
conn.Close();
}
return question;
}

View 7 Replies

Architecture :: How To Pass Data Between 2 Apps On Different Servers

Feb 23, 2010

i'm facing a problem with transfering data between two web applicatins on two different servers. For example on page A

I have a login box with LoginName textbox and Password textbox and Login button. What I am trying to achieve is that when i press Login button I will transfer data from Login and Password textboxes to page B and .net code on page B will try to validate the logging user. I was trying code like this but it won't works on page A

[Code]....

and on page B in Page_Load event

[Code]....

I was thinking of using Web Service between these apps, however i am not certain that it will works.

View 12 Replies

Architecture :: How To Pass The Data Between Data Access Layer And Business Acces Layer

Jun 3, 2010

here i have in 3-tier architecture , how to pass the data between DAL and BAL. i am using grid view to edit the data,when ever i click on the edit button all the corresponding fields should come to textboxes. i tried for delete ,it works fine bt not working to EDIT.

View 7 Replies

Architecture :: How The Data Pass From One Layer To Another Layer In Mvc Design Pattern

Apr 1, 2010

how the data pass from one layer to another layer in mvc design pattern...

View 2 Replies

Share Entity Data Model Amongst Layers?

May 17, 2010

How can I share the auto-generated entity data model (generated object classes) amongst all layers of my C# web app whilst only granting query access in the data layer? This uses the typical 3 layer approach: data, business, presentation.

My data layer returns an IEnumerable<T> to my business layer, but I cannot return type T to the presentation layer because I do not want the presentation layer to know of the existence of the data layer - which is where the entity framework auto-generated my classes.

It was recommended to have a seperate layer with just the data model, but I'm unsure how to seperate the data model from the query functionality the entity framework provides.

View 2 Replies

DataSource Controls :: Data Access Layers And App Data Database Information

Jan 3, 2010

I am using an SQL Express server hosted on a different machine and it is listed in my server explorer just fine. It is listed as my connection string in my web.config just fine as well and lastly it seems to sync just fine with my asp.net membership tables. My question is does it need to be listed in my app data folder of my site? Currently I have the ASPNETDB.mdf connection listed, which is apparently just a local sql express connection. The database I am using in my webconfig and other files is not listed so do I need to add it there?

Second question is about DAL, Data Access Layers. I have mostly been using presentation level SQL commands with my data presentation controls. Manually entering separate select, insert and update statements. I just went through a tutorial that stated the best way to interact with your database in asp.net is with DAL using table adapters. It mentioned that it gives you the ability to use strongly-typed references to each row. My question is can I use the same method multiple times on a single page. For instance a method inside an adapter named GetProductsByID(@ID) ? What if I want this bound to three different gridviews on a single page? Anyone have any other general things to point out about using DAL over presentation level commands?

View 2 Replies

Web Forms :: Finding Generic Tutorial On Persistence Data Access Layers?

Mar 26, 2010

where I can find a good generic tutorial on persistence data access layers?

View 2 Replies

Data Controls :: Display Marker On Open Layers Map On Gridview Row Click?

Apr 27, 2016

I need to show infowindow for the markers when clicked on gridview row. This link [URL] because i tried this way but could not show marker on map.

View 1 Replies

WCF / ASMX :: Singleton Object - Leave Business / Data Layers In Main Solution

Jan 13, 2011

I have an ASP.NET 4.0 site that I expect to come under extremely high volumes in the next month or so and I am attempting to maximize performance. The site is divided into the front end UI pages, as was as a business and data layer. My thought was to pull the business and data layer out and wrap them in a NamedPipes Connected Windows Service running in Singleton mode.

I created the windows service, got the connection setup correctly and now I am wondering if this is just asking for trouble. Is this a good idea or should I just leave the Business/Data layers in the main solution and let IIS spin those objects up and down for each request? In essence I was thinking that using a WCF Windows Service as an Application Server would be more efficient but that is just a theory

View 1 Replies

Architecture :: How To Pass The Values From Presentation Layer To Business Logic Layer

Oct 26, 2010

I am new to this .NET what is the difference between N-Tier and 3- Tier Architecture. If they are same. How to pass the values from presentation layer to business logic layer.

For Example

I have 10 controls in presentation layer. I passing values to these controls. How the architecture works.

View 3 Replies

Architecture :: Best Way To Pass A Values From One Application To Another Application?

Dec 8, 2010

Which is the best way to pass a values from one application to another application in asp.net

View 5 Replies

Interaction Between WCF, DAO And DTO Layers In An Application

Feb 25, 2011

how the WCF, DAO and DTO layers communicate with each other? I would appreciate if someone can specify which layer comes first and then how it interacts with the next layer

View 1 Replies

Web Forms :: Best Way To Work With Layers?

Mar 7, 2010

I have a form with mulptile panels hidden behind others. It is impossible to edit them in design mode without moving them to the side so that all panels are visible, so that is what I do. I use JavaScript to position the panels during runtime, but it is an innefecient way to do it.

Is there a way to make a panel or layer visible or invisible while working in design mode, kind of like autocad works

View 1 Replies

C# - What Should Layers In Dotnet Application

Apr 19, 2010

I am using layered architecture in dotnet (mostly I work on web projects). I am confuse what layers should I use ?

I have small idea that there should be the following layers.

user interface
customer types (custom entities)
business logic layer
data access layer

My purpose is sure quality of work and maximum re-usability of code.

some one suggested to add common types layer in it. Please guide me what should be layers ? and in each layer what part should go ?

View 5 Replies

Design: ORM And Application Layers

Nov 4, 2010

While designing (and then implementing) a layered application:

Is it correct to use the same ORM objects accross all layers? (which would go against encapsulation).

Or the presentation, business and data layer should each have their own objects? (which would lead to lots of code repetition).

e.g. (just to illustrate the question): if one uses Linq to SQL in the Data Layer and Visual Studio's O/R designer to generate the ORM objects, are those objects supposed to be used in the Business and Presentation Layers as well.

i.e.: Are the objects associated with the entities that the application handles a crosscutting issue?

View 1 Replies

MVC :: Dependency Inversion Between Layers?

Nov 1, 2010

Split off from http://forums.asp.net/t/1618613.aspx

I would like to get your advise on Dependency Inversion..Should i include it as a layer between Business Layer and Repository Layer?

I think its really great when different team members work on DAL n BAL etc or when your database will be changed in future. It actually removes the dependency of the Data provider but over the expense of additional coding overhead. My question is , is it really worth it? If i suggest this layer to my PM and give him the above two reasons then i dnt think he will accept it since most of the time each developer works on his DAL/BAL's, and Change in DB wud be the least of his concerns.

RAD in every layer..

I mean if there are any auto generation tools available for generating repositories etc.I read about MVCContrib Grid and i think its a good option to use for Grid.

If i use Spark ViewEngine then can i still use T4 templates to auto create custom views by customizing templates?

View 2 Replies

Passing Status Message Up The Layers?

Jan 3, 2010

I am trying to work out the best way of dealing with a mailinglist class I have written. I got a simple form on the page where people can add their email address. Depending on which page they add their email address they join a differnet mailinglist. So from the form I have 2 values passed to the DAL {mailinglistID} and {email} - Various checks are done in the DAL, such as checking if email exists, checking if email exists in that mailing list etc etc.

I would like to be able to present the status codes on the page, so in the DAL I return a number value and from the BLL return a string depending on the number value. DAL returns 1, means email exists in mailing list, BLL see's the 1 and returns "email exists" to the page.

I have no idea if this is the right way of doing it or not - the (problem or question) is that in the content page I am checking the if the returned string is "" or has a value, and presenting the message in a visable div.

Is this the best way to do this, or should the status value be converted to a message on the code behind of the content page.

(of course I could have got this all wrong, and need to start again.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved