Asp MVC Vs. Asp Web Forms / Breaking Code Design Into 3 Layers (presentation, Dal And Business) Meets MVC Concept?

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


Similar Messages:

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

DataSource Controls :: Linq To Entities - Multilevel Projection Into Business Class And Not Breaking Deferred Execution?

Mar 18, 2010

I have a problem. (this a simplfied example)

In Entity framework I have a class which is effectively

fooEntity
{
public Guid Id {get; set;}
and a collection of fooChildEntity
}
a fooChildEntity is again an entityframework class
fooChildEntity
{
public Guid kidId {get; set;}
}

Now I also have a pair of business layer classes foo and fooChild

foo
{
public Guid Id {get; set;}
ilist<fooChild> Children {get;set;}
}
fooChild
{
public Guid kidId {get; set;}
}

My aim is to write a linq to entites that will allow me to convert the entity foo and children into the business foo and children without breaking deferred execution ( I will be adding filters to reduce the recordset at a higher coding level in the business layer)

doing something like

this.context.fooEntity

.include(fooChildEntity)

.Select( fe => new foo { Id=fe.Id ,

fe.foreach(fec => Children.add( new fooChild { kidId = fec.kidId}))})

.AsIQueryable()

is plainly rubbish and would never compile - it is however an indication of the direction I was thinking .

Even if I got a foreach to work like that or similar it would break deferred execution

At this point there are around 300,000 foo entities which I will eventualy filter to 5 or 6 foo's - this is why deferred execution is needed.

View 1 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 :: 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 :: 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 :: 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

C# - Web App Using A 3-tier Design Pattern, One Of The Bottom Layers Provide Some Checking Mechanism To Ensure...?

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

Setting A Default Value -- Presentation Logic Or Business Logic?

Jun 18, 2010

I was wondering if setting a default value for a SelectList is considered to be presentation logic or business logic? For example, if a requirement is that an Employee cannot be saved without a Location, but 99% of the time the location that would be selected is a particular item -- say Atlanta. Because of this, the location SelectList should be defaulted to Atlanta when ever a entry screen for a new employee is displayed. Should I be defaulting the location in the model or in the view-model? One thing I realized is that the unit tests become awkward because in both cases, I'd be forced to test against a location that will always be present in production but I cannot create a unit test with my own test dataunless "Atlanta" was in the set of locations being used in the test.

View 4 Replies

MVC :: How To Make Business Layer Seperate From Presentation Layer

Feb 23, 2011

I've even got my JQuery Ajax submission going on now but I've encountered another problem. I *think* it's something to do with the structure I'm using but like I say, I'm fairly newo this.I have my AJAX form submission which builds my "PersonViewModel" (model for the presentation layer) in JSON and sends it to "@Url.Action("RegisterSubmit")" in my Person Controller. Now, I seperate my business layer from my View/presentation layer so in "RegisterSubmit"I'm verifying the model is valid then instantiating a new instance of my business model "Person", adding the values from "PersonViewModel" and then calling my "Save" function.

View 7 Replies

Architecture :: How To Design Business Objects

Mar 20, 2010

designing Business Objects. What a business object class can contain ?

I have looked many sample codes and articles. Some only use properties in them. Some use private members, properties and constructoers. As more I am reading becoming more confuse.

Some sample codes that I checked were making functions in BO classes as well. what a BO class should contain and what is its purpose. Should there be functions in them as well ? If yes how they can be differentiated from Business Logic class functions.

View 5 Replies

Architecture :: Business Object Design In Master Details?

Aug 19, 2010

I have the following scenario,There is a master business object containing 40 fields2 separate child business objectsIf I update a child record, I have to update master's 'Last modify by' status along with 3 or more fields in masterFor this purpose, I don't want to initialize a separate Master class object (as most of the fields are unused/wasted)The 'last modify by' also gets updated if the records in master get updated themselvesCurrently I have separate business objects for master table, Child 1, Child 2 etc.

How do I control this in my business object design ? Do I break up my master object ? Say I extract last 'modify by ' into a new class, through inheritance or some other way ?Is there a way that whenever child gets updated I use a 'small' class to update Master status only and whenever the master itself gets updated I do the same.Problem is that I am having redundancy in my small class (Master class also contains 'Last Modify By ',

View 5 Replies

Want Source Code About Remember My Password Using Cookies Concept?

Jan 20, 2011

i want source code about remember my password using cookies concept.

View 4 Replies

Visual Studio Debugging - Url Includes Foldername - Breaking Code?

Jan 15, 2010

When I right click on ASP.NET development server, it says http://localhost:1394/testing
as the ROOT URL. This does not go well with my code. I think the main reason is my code assumes it is in the root folder, and things start breaking when that is not the case. If I deploy this website, then it all works, but I lose my debugging capabilities. Is there a way I can make it skip the name of the folder (which is "testing" in this case)?I am using virtual URL. Things break on virtual urls, not on static ones. (But virtual url works fine when deployed, and make sure it is in the root folder, otherwise it will not work.) [URL]

View 2 Replies

Architecture :: How To Design A Centralized Business Or Service Authentication Architecture

Sep 22, 2010

i want to create a centralised business or Service authendication architecture in .net. for example, we have a clients like c1, c2, c3, c4, ... etc. everybody logins seperatly as well as grouply. ie, if client "C1" logins [with login authentication] he can access c2 , c3, c4 also without login authendication. So its like a google. if we enters gmail account, we can access orkut, picasa like that.. i need the cetralised architecture.

And, client "c1" seperately asks seperately how will be the authendication architecture.

so give me the single solution for both these two scenarios. how will be the architecture for these two and how is the Data Base (Login) Structure.

View 3 Replies

C# - NHibernate Select Most Recent Record That Meets Criteria?

Jan 27, 2010

Last night I started working on an NHibernate provider. I'm creating a criteria that several records will match, however I only want to return the most recent record (the record with the largest Id). I thought UniqueResult() would do this it cannot be used if a list would be returned otherwise.

I could theoretically select the full list and then return the desired record, but I believe there is a better way.

View 2 Replies

C# - N-layer Business/service Layer Design?

Jan 26, 2011

I'm trying to reevaluate our n-layer architecture and would love to get some based on your experiences. Here is our typical .NET n-layer (sometimes n-tier) design.

Project.UI
Project.Services
Project.Business
Project.Model
Project.DataAccess

DataAccess typically consists of Entity Framework 4 and Repository classes. I attempt to follow the Aggregate Root concept in order to avoid having a repository for table, easier said than done in my experience. I tend to have ~70% match between Repositories and Tables.

Model usually consists of my Entity Framework 4 entities, I've been using Self-Tracking EF entities with success.

Business is what I struggle with the most. I typically have a Manager class for every Repository. This class will contain methods like .Add() which will perform business validation before forwarding down to repository.Add().

Services, typically I will only implement this if in fact I am looking to create a web service based solution. This layer will be tasked with marshaling requests/responses between DTOs and entities. And most importantly provide the more coarse grained interface. For example a TradingService.SubmitTrade(), which is really a facade for a business transaction which might include AccountManager.ValidateCash(), OrderManager.SubmitOrder(), etc.

My business layer is very entity centric, really it's just the glue between the entities and the repository, with validation in between. I've seen many designs where the Service Layer is what holds a reference to the repositories (in essence skipping the "business layer"). In essence it serves the same purpose as my Business layer, it does the validation, however its' responsibility (and naming) is a higher level, more coarse grained business transaction. Using the example above the TradingService.submitTrade() will not delegate to any business manager classes, it would itself query the necessary repositories, perform all the validation etc.

I like my design in a sense that I can reuse a business layer method in multiple service calls, however I hate the fact that for every repository I have a matching business layer manager, creating tons of extra work. Maybe the solution is a different type of grouping at the Business Layer level? For example combine individual Manager classes like PhoneManager and EmailManager (note I have Phone entities and Email entities) into a logical Manager class such as ContactsManager (note I don't have a "Contact" entity type). With methods such as ContactManager.GetPhones() and ContactManager.GetEmail(), etc.

View 1 Replies

Entities Framework 4 Code First: Business Methods

Oct 15, 2010

Could anyone tell me where is the best place to put my business methods when using EF4 code first POCOs? Should they go in the POCO class? E.g.

public class customer
public property Id as int32
public property Name as string
public property Archived as boolean
public sub MarkAsArchived
me.Archived = true
end sub
public function EmailAllInvoices as boolean
...
end function
end class

Or should the POCO class be as clean as possible and a seperate class be used for business logic which accepts an instance of a customer POCO in the constructor to work on?

View 2 Replies

Moving The Javascript Code To Design View Is Not Working. Only Code-behind Attributes.Add ("onclick" Works. Puzzled

Jul 15, 2010

I wanted to disable a button after it is clicked and at the same time fire the post back event to generate a report. My first set of code did not work because soon after the button is disabled the page won't submit/post back. here's the first set of code which was not implemented. the onclientclick calls a javascript function which has these lines

document.getElementById('btnGenerateReport').disabled=true;
GetPostBackEventReference(btnGenerateReport,'');

since it was not posting back,i tried the following on page_load code behind

btnGenerateReport.Attributes.Add("onclick", "this.disabled=true;" + ClientScript.GetPostBackEventReference(btnGenerateReport, ""))

that worked well. but I tried to copy the javascript that got generated and pasted directly on design view

onclick="this.disabled=true;__doPostBack('btnDownloadClientsWithConviction','');"

its not working from client side alone after I disable the code behind attributes.add
but when I check the view source the 2 pages are the samewhy am I not able to move the code from code-behind to design view?

View 1 Replies

C# - Web Service Design - Error Code (store In Source Code Or Store In Database?

Jan 19, 2011

Web service error response (code/message etc) would you store it in a database? or would you keep the error response in a method.By the time I'm done with this, there will be hundreds of error response, maybe in the future, thousands? (I dont know yet, depends how large this web service grows).EDIT: error response is the response returned back to the application via the web service, (not to be confused with error logging).

View 1 Replies

Web Forms :: ObjectDataSource Concept - From Where Data Is Pulling

Feb 17, 2010

I was hired to do some contract work for a short contract. I am looking at this code on this Aspx web form. What they do is load the labels for a radio button list from an ObjectDataSource object. Well this is the first time I have ever heard of an ObjectDataSource. The problem is that I don't even know where this object is pulling data from. With a SqlDataSource object, I can easily view the flyout menu to see the sql query where the data is being pulled from. Anyway, I need some figuring out where objectDataSourcePlanType lives and where it is pulling data from. I know I can't list the entire project, but I am sure someone who is familiar with ObjectDataSource

<tr>
<td>Type of Plan</td>
<td><img alt="Required" src="/Images/arrow.png" /></td>
<td>
<asp:RadioButtonList ID="radioButtonListPlanType" runat="server" AutoPostBack="True" DataSourceID="objectDataSourcePlanType"
DataTextField="PlanTypeName" DataValueField="PlanTypeId" OnSelectedIndexChanged="RadioButtonListPlanType_SelectedIndexChanged"
RepeatColumns="1" RepeatDirection="Vertical" AppendDataBoundItems="true">
</asp:RadioButtonList>
<asp:RequiredFieldValidator ID="requiredFieldValidator10" runat="server" ControlToValidate="radioButtonListPlanType" ErrorMessage="Type
of Plan is required."
SetFocusOnError="true" />
<asp:ObjectDataSource ID="objectDataSourcePlanType" runat="server" SelectMethod="ListPlanTypes" TypeName="Candle.Web.PlanRequest.CommonWeb">
</asp:ObjectDataSource>
</td>
</tr>

View 2 Replies

Web Forms :: Response.Write Breaking CSS?

Jan 5, 2010

I have an aspx page and when the user clicks a button the following code runs:

Response.Write(string.Format("<script language='javascript'> window.open('DisplayImage.aspx?DocumentID={0}', 'window','HEIGHT=600,WIDTH=820,top=50,left=50,toolbar=yes,scrollbars=yes,resizable=yes');</script>",
id));

The variable id is declared and it's value set eralier in the method.When the new window opens it displays the image properly, but the existing page suddenly loses all of it's styling. The links double in size and change font family. Does anyone know a way to retain styling on the calling page?

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

Integrate HTML / Design With C# Code In MVC?

Mar 31, 2010

We're working on a new ASP.Net site. The last major site we did was in classic ASP--the procedure we used there was to have the HTML completed first, then "bring it to life" with the ASP code.

In the ASP.Net world, how does this work? I.e. how do the designers do their work if much of the mark-up is actually being generated by the server controls?

We are also looking at ASP.Net MVC as a potential lightweight alternative.

Would be very interested to know what was worked best for people in both scenarios in terms of working with the designers and integrating their work with the code.

UPDATE: I refined what I was asking here, not exactly the same question but similar enough so this one could probably be merged with it.

View 3 Replies

Automatic Design Code Generation?

Jan 9, 2010

write a code, that generates the ASP.NET Desgin code automatically, for a given input. Can anyone guide on this.

View 2 Replies







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