C# - N - Layered Application: One Class Library For All Layers Or For Each Layer?

Mar 3, 2011

N - Layered Application: One class library for all layers or for each layer?

View 5 Replies


Similar Messages:

How To Access Session Values From Layers Beneath The Web Application Layer

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

C# - Can't Access Class Library In A Web Application

Feb 28, 2011

I have two projects in one solution :

Class Library for my BLL and DAL classes Web Application for my PL

Now I just use the keyword "using" in the BLL and DAL classes and get access to their methods easily. but now I try to reference the BLL and DAL in the web application project through the "using" keyword but it won't let me (the name space couldn't be found (are you missing reference ?)) .. then I tried to reference the library's dll (grabbed it from the ClassLibrary/bin/debug) and the same error just popped out again!

Summery:

My solution consists of two projects (ClassLibrary and a WebApplication) and I want to use/reference the classes/dlls of the class library in the web application

View 3 Replies

C# - How To Add A Reference To A Web Application Project In An Associated Class Library

May 13, 2010

I'm working on an internet application that has been set up as a web SITE project (I know...) in Visual Studio. I need to add additional features/functionality so have added a class library to the project and referred to it in the main web site project.

The issue now arises because I need to make use of core objects which live inside the App_Code directory in the web site project but this project doesn't appear to expose its DLL like web app/ code library projects do. Because of this I can't add a reference to the web site project in the class library to leverage the common site-wide code/objects.

I can't move the stuff out of App_Code so I'm looking for a way to refer to the website project dll from the new class library.

View 3 Replies

MVC :: Custom Ex Class Be In The Repository Layer Or The Domain Layer?

May 6, 2010

My repositories throw exceptions (System.Exception) when some things go bad and I know this is bad practice.. so i will create a custom exception (DataException). My question is should this custom ex class be in the repository layer or the domain layer? Im thinking it should be in Domain layer where all business objects and repository interfaces live but just want to make sure.

View 3 Replies

Deploying Web Application Which References Class Library With WCF Service?

Jan 28, 2011

I have a separate environment for development. On my production server, where we mostly host web applications, we deploy the precompiled version of the web project. While doing development I work on three projects. One is the WCF Service. Two, is the class library project. This library has classes which makes calls on the WCF service. And the third, is a web project which consumes the class library.

The last two projects come under one VS solution. I host the wcf service in the development environment. This service is added as service reference to my class library. I am unable to visualize what will happen once I add the DLL (viz output of the class library project) to my web project, and, the web project has to be deployed. At the time of deployment I have to change the service reference (the url of the svc file will change as it has to point to the production wcf service). How to go about this? What must I take care when adding the dll to the web project?

View 3 Replies

Folder / Contents Of Class Library Appearing In Website Project Of Web Application

Oct 8, 2010

When I make an asp.net web application and add class libraries to the solution, the website project itself has a folder with the same name/contents as the class library.

Eg I make a web application called Test, add a project which is a class library, to the solution, called testAbc, and then there is a folder at the root of the website project called testAbc with the contents of the class lib.

View 4 Replies

Folder / Contents Of Class Library Appearing In Website Project Of Web Application?

Feb 14, 2010

When I make an asp.net web application and add class libraries to the solution, the website project itself has a folder with the same name/contents as the class library.

Eg I make a web application called Test, add a project which is a class library, to the solution, called testAbc, and then there is a folder at the root of the website project called testAbc with the contents of the class lib.

I read why this happens in a book a while ago but can't quite remember now.

View 1 Replies

Visual Studio :: Call To The Class Library From The Windows Form Application Works Fine?

Aug 12, 2010

I have a windows service that calls a class library. The call to the Class library from the windows form application works fine. But from the service I do get the desired output. The event viewer does not report any error. The service was working fine until the recently when the server got remastered. Any suggestions what might have gone wrong?

View 2 Replies

Architecture :: Layered Web Application. XML As Data Storage?

May 4, 2010

I'm thinking of using 3 layered architecture in my web site.Kind of classic layers - Presentation, BL, DAL and BO - business objects, just like in this great article http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=416I will have 4 projects according to levels.I'm goung to store data in xml files and my question is where should those files be located? In App_Data folder of web site? Then how DAL will know path where to find files to parse?

View 4 Replies

Data Access Layer With Enterprise Library?

Jun 14, 2010

I've VS2008 and enterprise library 4.1 installed .I want to display few records in the categories table of my NorthWind in my presentation layer through data access layer with enterprise library. I've added references of the following dlls in my data access layer project( which is of type class library)

Microsoft.Practices.EnterpriseLibrary.Common

Microsoft.Practices.EnterpriseLibrary.Data
Microsoft.Practices.ObjectBuilder2

how to access data from the database using datareader , entity beans and rendering data on to presentation layer.

View 2 Replies

Use Enterprise Library For Another Website On Same System To Build Data Access Layer

Feb 22, 2011

In my system, the data access layer of one of the website is build using the enterprise library. Now I am developing another [different] website. How can I use the enterprise library to create the data access layer? I am very beginner to Enterprise Library? How can I configure it for my website? Should I have to include the DLL? How it will take the connection string from the Web.Config file?

View 1 Replies

Web Forms :: Way To Control Null When Inheriting From Class Library Class

Sep 16, 2010

I have this Control directive in a usercontrol (i've changed the namespace and class name):

<%@ Control Language="C#" AutoEventWireup="true" Inherits="Namespace.Path.To.ClassName" %>
<asp:TextBox runat="server" ID="txtComment" TextMode="MultiLine" ValidationGroup="comment" />
ClassName is a class that lives in a class library and this is the class:
namespace Namespace.Path.To
{
public class ClassName : System.Web.UI.UserControl
{
protected System.Web.UI.WebControls.TextBox txtComment;
protected void Page_Load(object sender, EventArgs e)
{
HttpContext.Current.Response.Write(txtComment == null);
HttpContext.Current.Response.End();
}

View 3 Replies

C# - How To Show A Message Box From Inside A Class In A Class Library

Feb 24, 2010

Can anyone tell me how to show alert message inside the .cs file of class library project in c#? I am calling a method of cs file in classlibrary project. Whenever the control comes to the alert message statement inside the method, alert message should be shown on the web page(aspx) and the next statement to the alert message statement should not be executed.

View 3 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

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

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

C# - How To Inherit A Page Class From A Class Library

Mar 16, 2011

I might be asking a dumb question, but I have a client for whom I need to build many websites (10+) (asp.net 3.5) which will all the pages on each site will have the same codebehind, but the sites will launching in different regions and whilst following the same template, will have different content.I have built and launched site 1, and sites 2, 3 & 4 is nearly live, but it occurs to me that as all the sites are basically the same, the code is going to get more complicated to update as it will be duplicated, so if I need to do a bug fix on one site, I'll need to do the fix on all websites (and this is going to get complicated.)

I was wondering if it possible to somehow create a class library of all the current aspx.cs files, reference this dll in each website and then inherit these classes into the .aspx.cs files. So default.aspx in each site would still have a CodeFile of "Default.aspx.cs", but Default.aspx.cs would inherit the corresponing class from the dll:

using WebPagesClass;
public partial class _Default : WebPagesClass._Default
{ }

The reason for doing it like this is that if I need to change any code on a specific website (for minor changes in languages for instance), I can override the page functions and change the parts required. For all other pages which have not cha, I can just copy from a single website.Is this vaguely possible? If not anyone one got any killer suggestions of how to manage so many websites from a single codebase?

View 2 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

Visual Studio :: How Many Layers In LINQ Application

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

C# - What Layer Does A UserControl's Base Class Belong

Aug 28, 2010

I have an asp.net usercontrol (ascx) that inherits from an abstract class (that inherits from a UserControl). My Project is in a 3-tier architecture (DAL -> Bll -> UI/Views). Currently there are no class files in the UI layer (other than the code-behinds). Which layer should I add this abstract class to?

View 2 Replies

C# - Manage Back End Data Layer Class Instance Throughout Site?

Jan 21, 2011

I'm new to web dev. and I'm using asp.net/C# to build a website. I currently have a class called DataLayer that I'm using to perform all of my database functions, and also store some queried information. I initially had this class as static, because that's how I wanted it to behave, but then realized that will be all kinds of bad for multiple users.

I have to make an instance out of this class in order to use it, but I need to maintain the same instance throughout several webpages for that user. Any thoughts or ideas on how to go about this approach? How to pass this object from page to page? Store in session variable, as a global object somehow?

View 2 Replies

Class Library Can't Be Found?

Apr 19, 2010

I have a web Application and have created a seperate class library project.I am trying to use the Class Library by referencing it in the Web Application. I am doing this by right clicking the web application and clicking 'Add Reference...'. I then browse to my Class library and click ok. This gets added to a Bin folder in my web application.The problem is I can't actually get any of the objects that are in the Clas Library. I have tried adding a using statement to the top of the page. It tells me that the object could not be found (are you missing a using directive or an assembly reference?)Can anyone tell me what I'm doing wrong?

View 3 Replies

Get A File In Class Library?

Dec 30, 2010

i have a class library that get a xml file and read it and set some property from that data

may code is like:

[Code]....

the problem is this code is in class library and the file is in web form application.

View 1 Replies







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