Web Forms :: Asynchronous Paging And 3 Tier Layers?
Sep 3, 2010
I have a query about asynchronous paging using RegisterAsynchTask or AddOnPreRenderCompleteAsync
If I have a 3 tier web application with the UI, Business Layer and the Data Access Layer and I'm doing the Begin and End asynchronous processing of a method at page level (UI). This UI method accesses the DB and goes through all the layers starting asynchronously from the first page, then continuing "normally" through all the other layers. These underlying layers are all synchronous but started asynchronously through the first Page.
My question is how should asynchronous paging processing be handled with regards to layers? Do I need to set the methods being used at all levels asynchronously (using Begin and End event handlers) ?
And what about MasterPages... I can't Asynchronous processing for them. RegisterAsynchTask is not available and neither AddOnPreRenderCompleteAsync.... what I'm missing?
I'm trying to write a web app using 4-tier design pattern ( Data Store, DAL, BLL and UI). Among other things this app would also implement a forum.
Suppose I want to move a thread from one forum to another. In order to do this, UI layer must pass down to other layers the ID of a thread and the ID of a forum to which I wish to move this thread ( UI would pass these parameters by calling method A in BLL layer and A would in turn call method B in DAL layer... ).
a) Now should one of the bottom layers provide some sort of checking mechanism to ensure that the two ID arguments supplied by UI layer really represent an existing thread and an existing forum or is it the responsibility of UI layer to provide valid ID values?
EDIT:
I would consider the ability to pass invalid IDs a bug.
Should non existing ID be considered a bug just in the case of moving a thread, or also in the case of displaying a thread. Thus when user navigates to page Showthread.aspx?ID={0}, if query string parameter ID references non existing ID, If none of the layers check for the validity of ID, then GridView simply won't display any
"But in this case it doesn't look like the ids are in any sort of list. If they were one could only assume that this would never happen as I assume the lists would be populated by a stored procedure or a DAL procedure that pulls all valid IDs."
But even if user chooses IDs from a set of list, by the time it posts the page back, the DB table containing this ID could be changed in the mean time by admin or whomever?!
I am working on 3 tier architecture: UI, BL, DAL. In my UI i have following code for Asynchronous page processing:
[Code]....
But I want a database fetch operation to be performed in this asyncronous method. And due to 3 tier arch. i am unable to do this in UI Layer. Can anyone guide me that how can I implement Asynchronous processing in 3 tier architecture? Note: If you are going to place EndAsyncWork1 in DAL then show that how can I return a value back to UI layer from this function.
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
Is there a way to use the GridView paging and having the links not use JavaScript. So that when you click on the page number 5 (for example) that link is a hyperlink.
I'd like to implement a custom paging template for my formview that displays numeric paging as well as next/previous buttons. The pre-defined templates only appear to have numeric first last as an option. Can anyone recommend a good article that covers this?
I'm a junior programmer, i do not get the concept of MVC! My method of coding is seperating my application design into 3 layers:
Presentation Layer Business Layer Data Access Layer
I find it very practical to a junior developer or at least to me, so i do not really get the point of MVC since i believe MVC just tries to separate logic from UI. Right?
I decided to have this book to help me have a better idea on code design:
My application was designed using following n-architecture : Presentation layer...wcf service layer...business logic layer..data access layer Presentation layer is in one server,wcf service,bll,dal are in another server. I knew something about wcf but how to implement this architecture.
I am looking for code sample for the above type of architecture.
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
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?
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?
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.
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.
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.
i am creating a class library project and adding new ado.net data model into it. created model automatically generetes codes. ModelENtities and entity classes.
i want to separate ModelEntities context class and entity calsses to two layer as two class library. is this possible?
assume that I do this and when I update the model from database , do separated classes update?
I have a theoretical question.i have a function in DAL that does a select sql query. and these are my questions:
I was told that it's not appropriate to pass datasets between layers. so how should i pass the results? which value should i return to the BLLBAL (i thought of a List<>).? and to the presentation layer.
currently my implemention is like that:
SqlCommand cmd = new SqlCommand("getRequestById", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@requestId", rId)); SqlDataAdapter datAdp = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); datAdp.Fill(ds,"getRequestById"); List<String> rs = new List<string>(); for (int i=0; i<11; i++) { rs.Add((Convert.ToString(ds.Tables[0].Rows[0].ItemArray.GetValue(i)))); } return (rs);
is it better to create xsd file in VS2010 with only fill (all other implemtation i'll do on my own) property.
I added New Item, DataSet, over that i added tableadapter with stored procedure. i declared that it will do only the fill property(without returning the data). i want to implement all the other properties by demand in my way.
i wrote in the dal test.getRequestById1DataTable dt1 = new test.getRequestById1DataTable() how can i get the data and pass it between the layers?
If I have a 3 layer web forms application that takes user input, I know I can validate that input using validation controls in the presentation layer. Should I also validate in the business and data layers as well to protect against SQL injection and also issues? What validations should go in each layer?
Another example would be passing a ID to return a record. Should the data layer ensure that the id is valid or should that happen in BLL / UI?
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.
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?
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.