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
Similar Messages:
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
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
Feb 17, 2010
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?!
View 5 Replies
Dec 20, 2010
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:
http://www.amazon.com/Professional-ASP-NET-Design-Patterns-Millett/dp/0470292784/ref=sr_1_1?ie=UTF8&qid=1292836936&sr=8-1
Note: i also decided to start learning about TDD.
QUESTION:
Is breaking my code design into 3 layers (presentation, dal and business) meets MVC concept?
View 4 Replies
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
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
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
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
Apr 1, 2010
I have question about N-tier architecture. everyone about 3-Layer architecture these are:
1). UI Layer,
2). Business Layer,
3). Data Access Layer.
i already have worked on this.
Then i heard about LINQ to sql. how many layer an web application should contain.
As my knowledge. if i use LINQ to slq then i have to worked only 2-Layer:
- Data Acess/Business Layer: which contains only *.dbml files which is my database and
- UI Layer: which contains *.aspx files.
View 3 Replies
Mar 3, 2011
N - Layered Application: One class library for all layers or for each layer?
View 5 Replies
Feb 23, 2010
can't connect to sql 2005 express sp1 and vs is also sp1. 2) Which my guess is because of the database connection not being able... design view is not able to pull in the application for design, it's as if there is no theme and css just white background and black print.
View 1 Replies
Apr 23, 2010
We have many instances in our application where we would like to be able to access things like the currently logged in user id in our business domain and data access layer. On log we push this information to the session, so all of our front end code has access to it fairly easily of course. However, we are having huge issues getting at the data in lower layers of our application. We just can't seem to find a way to store a value in the business domain that has global scope just for the user (static classes and properties are of course shared by the application domain, which means all users in the session share just one copy of the object). We have considered passing in the session to our business classes, but then our domain is very tightly coupled to our web application. We want to keep the prospect of a winforms version of the application possible going forward.
View 3 Replies
Nov 10, 2010
I need to develop an application, which will get records (orders) from one application and process them. The updates to this records (order updates) will be sent back to the source application for end customer reference. I'm planning to achieve this data synchronization at the database level using triggers and stored procedures to insert database between the 2 databases.
But, the issue is I have to deploy this application in 3 different customer sites and I have to change the database names (cannot use the same database name) in each deployment manually. Because of this deployment issue, I was thinking of handling this within the asp.net application where I can store the db name in the database and then build the query within the application, but I dont want to do it as building queries like that doesnt look very professional.
View 2 Replies
Oct 4, 2010
I am working with a financial application and am looking for the best solution for designing my application.
We have 100's of stored procedures where most/all of our business logic sits. We have WCF web services projects built using Web Service Software Factory (http://servicefactory.codeplex.com/). We have stored procedures built for nearly everything (tables, dropdowns, etc..) and each of these stored procs have their own webservice exposed to be called by the web application. Each web service is a very simple method that calls the stored procedure with the exact paramaters of the web service. I am not too sure if this is the best design and would like to ask for suggestions and alternatives to the design. Does anyone else have a similar environment ? How is it implemented on your end ?
View 2 Replies
Jan 18, 2011
I am very new to application design, how and from where should i start to design application
View 3 Replies
Feb 8, 2011
I've been asked to re-write an existing VS 2003 applicatoin in VS 2010. The application contains multiple sections that allows certains users the ability to edit based on security roles. Each user is able to view the sections. There is ton of code to enable/disable section permissions for each user. Is there a better option available in VS 2010? I'm not too familiar with MVC and not sure if it would work in this scenario - each section should be available when the users login.
View 9 Replies
Mar 9, 2010
I've got a web application with 3 layers: front, business and data. I'm using linqToSql for retrieving my data from the db. On the front end, I'd like to show the data that's being pulled from the database. In online examples all code is shown in the same layer. I'm wondering if it's good design to put a reference to the linqtosql classes in my front end so I can bind the results to my gridview, or whether I should use a different way. Since the user should be able to update the data, the easiest thing would be to use the gridview, connect it to the linq2sql datasource and bind it that way, but that would totally defeat my 3-layer structure.
View 1 Replies
Nov 4, 2010
I'm about to begin designing the architecture of a personal project that has the following characteristics:
Essentially a "game" containing several concurrent users based on a sport. Matches in this sport are simulated on a regular basis and their results stored in a database. Users can view the details of a simulated match "live" when it is occurring as well as see results after they have occurred. I developed a similar web application with a much smaller scope as the previous iteration of this project. In that case, however, I chose to go with SQLite as my DB provider since I also had a redistributable desktop application that could be used to manually simulate matches (and in fact that ran as a standalone simulator outside of the web application). My constraints have now shifted to be only a web application, so I don't have to worry about this additional level of complexity.
My main problem with my previous implementation was handling concurrent requests. I made the mistake of using one database (which was represented by a single file on disk) to power both the simulation aspect (which ran in a separate process on the server) and the web application. Hence, when users were accessing the website concurrently with a live simulation happening, there were all sorts of database access issues since it was getting locked by one process. I fixed this by implementing a cross-process mutex on database operations but this drastically slowed down the performance of the website. The tools I will be using are:
ASP.NET for the web application. SQL Server 2008 R2 for the database. probably with an NHibernate layer for object relational mapping. My question is, how do I design this so I will achieve optimal efficiency as well as concurrent access? Obviously shifting to an actual DB server from a file will have it's positives, but do I need to have two redundant servers--one for the simulation process and one for the web server process?
View 1 Replies
May 17, 2010
I'm trying to build a small, web application. But I want to use desing patterns in it. So I have a question: which desing patterns do you use and why in asp.net applications?
View 11 Replies
Mar 10, 2010
designing a view for Mobile browsers in ASP.NET MVC framework. I am new to this mobile web application development. I learned already how to provide a diffrent view when the request comes from a mobile browser. but now i need to learn, how to design the view with a good look and feel. I have demo this weekend with my client so i would appriciate if some one respond imidiately.
View 2 Replies
Sep 22, 2010
I'm trying to decide which of the two factory patterns I should use in my Asp.Net applications:
1 : All DAL providers derive from same abstract base class DepartmentsProvider, which defines public interface of the class ( all the necessary CRUD methods for which derived classes (providers ) provide a concrete implementation ). BLL layer instantiates correct provider by calling DepartmentsProvider.Instance:
public abstract class DepartmentsProvider
{
static private DepartmentsProvider _instance = null;
/// <summary>[code]....
In first case we implement new provider by deriving from DepartmentsProvider class, while in second case new provider is implemented by deriving from DBProviderFactory. What are pros and cons of each implementation?
View 1 Replies
Sep 6, 2010
I am starting to design my own CMS , and i want it to be modular to add more functionality later by me or by any other developer I put my eyes on joomla CMS (very popular ,robust and extensible) I want to make a CMS with asp.net to be just skeleton and all functions are done through components
Functions like :-
User management
Content Management ,editing and display etc.
My main idea is to let the skeleton to know from the query URL the required component and pass all other parameters to it and the component do the rest (parse parameters display results etc.)
the problem is how to achieve this how to call the component and and how to let it render its UI and pass it to the skeleton to put it in the appropriate place in the main site template
View 4 Replies
Dec 2, 2010
i am working on a asp.net webforms app, and i have to create 'dynamic order lines'That is : you select a product and a quantity, and the amount is calculated.
To visualize: this is on one 'line', so forst product dropdown, next to it the quantity textbox and next to that the amount label.
Then you click 'add another product', and another 'line' is added with a product dropdown, quantity textbox and amount label.
So you can click add and add and add....
Now i was thinking how to implement that, and i came up with two choises:
'add html client side' and 'add user control server side'
The first looks more fancy of course, but i also have to create some server side code to generate the lines again, when the user says 'go' but after validation i have to warn the user for example the amount was over credit or the quantity was to high. Then i get the 'client side' added html, and i have to reproduce that in my code behind, am i right?
On the other hand (add user control server side), i have to create a new user control on 'and another product' postback, which might look easier in the beginning because it's all strong typed, and the client side (jquery / javascript) isn't?
And one more thing: there is a possibility (they are not sure yet) that this functionality is wrapped within a 'section', with an address box and call it an order.And then: the user can add that 'section' also multiple times, so he can create multiple orders in one page, so i have to create multiple sections for an order, and within that order have the possibility to add another product.It looks like it will be hard to do this client side, especially with generating id's?
View 2 Replies
Jul 18, 2011
I'm in the process of re-writing an existing survey application that is currently using nested repeater controls to display questions and answers. The application was not designed with future enhancements in mind and its a pain any time a new question has to be added to the application. The repeaters currently contain questions, answers, and controls(texbox, radiobuttonlist,etc.)
Is the repeater the correct control to use for this type of application? What is the best way to design this type of application and table structure? Are there any new controls or features in VS2010? How to design this application the correct way and make it more flexible?
View 6 Replies