Facade Pattern For Asp.net Mvc Application

Feb 16, 2011

I have an MVC2 application with the following classes:

-OrderModel
-LineOrderModel
-OrderController
-LineOrderController

In the OrderController class I'm recollecting some values of a web form . Until now, I created instances of each order line (LineOrderModel class) and OrderClass inside of the Controller.

I was trying to create a OrderFacade class in order to encapsulate the different things to do when creating an order.

So in that class I created a method like this:

public void saveOrder(int idProvider,decimal? price)
{
// Here I create instances of OrderModel and LineOrderModel
// and assign their properties
}

but my problem is I don't know how to pass all the order lines captured from the web form.

I think it doesn't make sense to create and pass to that method a List with orderLines class (because the point of this is to operate with the Facade, not with the class directly)

How could I encapsulate the different lines (all with properties like numberUnits,idProduct ...) into a List of generic objects, each one with these properties?

Maybe something like a List<List<object>> ?

View 1 Replies


Similar Messages:

Architecture :: Facade Pattern (banking App)?

Sep 20, 2010

I just started working on one of the application, bascially its some maintanence work. I see from the application that Facade pattern has been utilized as I see Class Library projects named as Business Facade, Data Facade.

Though I am not redesigning this, but just wanted to know what this pattern is, a simple explanation, use, real world example should be good enough. The application is basically a banking app. I know its diff but if anyone can give me some hints/points as in why the designer chose this pattern (banking app).

View 5 Replies

Pattern For Retrieving Complex Object Graphs With Repository Pattern With Entity Framework

Oct 13, 2010

We have an ASP.NET MVC site that uses Entity Framework abstractions with Repository and UnitOfWork patterns. What I'm wondering is how others have implemented navigation of complex object graphs with these patterns. Let me give an example from one of our controllers:

[code]....

It's a registration process and pretty much everything hangs off the POCO class Person. In this case we're caching the person through the registration process. I've now started implementing the latter part of the registration process which requires access to data deeper in the object graph. Specifically DPA data which hangs off Legal inside Country.

The code above is just mapping out the model information into a simpler format for the ViewModel. My question is do you consider this fairly deep navigation of the graph good practice or would you abstract out the retrieval of the objects further down the graph into repositories?

View 2 Replies

MVC :: AsyncController Gripes / Working Pattern For Converting A GET-POST-GET Pattern To Asny?

Feb 23, 2010

Does anyone have a working pattern for converting a GET-POST-GET pattern to asny?

I'm encountering the following issues:

1. You cannot mix Sync and Async action methods SubmitForm(), SubmitFormAsync(bool? confirm), SubmitFormCompleted() ... (because the resolver gets all confused ... it doesn't use the HTTP verb to decide who to target. BTW: I think that's poor design, or a bug)

2. Renaming the get method name to something else eg: SubmitFormConfirmation(), SubmitFormAsync(bool? confirm), SubmitFormCompleted() would be very awkward if it works ... because you have to doctor the <form markup to specify an action name.

3. You cannot give them all async names SubmitFormAsync(), SubmitFormAsync(bool? confirm), submitFormCompleted(), because the call just keeps malfunctioning. It sometime even behaves as if you are requesting a delete of something.

Can someone give an insight from an actually working sample.

View 5 Replies

Using WCF Callback And Web Application To Implement Publish/subscribe Pattern?

Mar 1, 2011

I'm trying to use WCF Callback to implement publish/subscribe pattern. I would like to send the message from UserA to UserB or UserA to every clients at the moment. I got an example from here

In my app, I use asp.net as a client to connect wcf service instead and I found a problem when I subscrib to wcf service.

The wcf service does not hold any other clients object. So when I call GetAllClients(_guid), It will return only 1 client which is itself.

Here is the code in asp.net page (i put every control inside updatePanel)

[code]...

Is it possible to implement this publish/subscribe with asp.net and wcf callback? (I already tried on window app and it worked fine)If it is possible, how can I keep all clients that is connecting to WCF Service so I can use those GuId to call callback method.

View 1 Replies

Best Design Pattern For Associating Subdomain With Area And PRG Pattern?

Aug 21, 2010

Now that the next version of ASP.NET MVC is being prototyped and previewed (ASP.NET MVC 3 Preview 1 came out a couple of weeks ago), I wonder if we should call the attention of the Core Dev team (S Hanselman, Phil Haack and all) to this "feature."there a easy/non tacky way of associating subdomains &#8594; areas?Something like:
[URL]Also, whats the best accepted design pattern in implementing PRG pattern in ASP.NET MVC? I guess it should also get some official loving in MVC 3.

View 2 Replies

C# - When Implementing The Singleton Pattern In A Web Application The Static Variable Scope?

Jan 25, 2010

want to make sure I am not assuming something foolish here, when implementing the singleton pattern in an ASP .Net web application the static variable scope is only for the current user session, right? If a second user is accessing the site it is a different memory scope...?

View 4 Replies

Design Pattern For A Simple CRUD Data Driven Application?

Jul 28, 2010

the best practice for a designing a simple CRUD application with some screens updating various tables (like admin pages to maintain static data for an application). the simplest way would be to drag a data grid/gridview, bind it to a dataset and use a data adapter for CRUD operations. but if this application needs to be scalable, lets say to add any extra UI/business logic in future, then is there any design pattern that can with this? should I be using an object data source control and bind it to business objects instead? or are there any better ways of doing it? should I build a complete layered application or will that be overengineering for this requirement?

View 3 Replies

Resolve Url In Facade Or Controller Class

Jan 28, 2010

I have a facade class that my controller class calls out to and in that facade class, for whatever reason, I'm building a string a href element. And it resolves fine in casini but when it gets out in the real world like localhost it doesn't work. Is there a way to do this?

string goBackLinkForErrorMessage = "<br /><a href='/MyController/Action?id=" + blah + "'>Go Back</a>";

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

Session Facade Vs Singleton Object Design Patterns?

Mar 27, 2010

which one is better in "Session Facade Class" and "Singleton Object" design patterns in ASP.Net? Also, please state the scenarions where specific design pattern is advisable to use.

View 1 Replies

Architecture :: Which Pattern You Use?

Sep 17, 2010

I wanted to know which all design pattern have you used in your application. Just wanted to see a general idea of most commonly used, popular design patterns. I was going through this site"

http://www.dofactory.com/Patterns/Patterns.aspx

and it has tons of design patters, I have heard about singleton and factory but not others.

So guyz which all popular efficient patterns are there and how would you determine which one suits your app. Can we make a app without a design pattern.

And lastly which one are the most simplest ones out there which are easier to implement.

View 2 Replies

ADO.NET :: Using Singleton Pattern?

Aug 4, 2010

I have a class which fetches the data from the database. Say First name, Last name , Telephone number etc and display it in my .aspx page. This data is common to all the users. So i would like to use Singleton pattern so that the object is not created again ,just use the created object for all the users. Can any one help me with the simple code snippet example.

View 3 Replies

MVC :: DomainRegistry IOC Pattern?

Jan 12, 2010

I am new to IOC design. My company application has this following code:

My Question in regards to the below code:

1. I did not see .TheDefaultIsConcreteType.How does the below code knows which is the default type.

2. Also if someone can explain me what is that scan method in the below code doing?

[Code]....

View 1 Replies

Does PHP Supports MVP Pattern

Dec 25, 2010

There are lot of examples explaining MVP pattern using ASP.NET but not found anything using PHP.

I am PHP programmer and want to know where can I get MVP pattern PHP examples?

View 3 Replies

MVC :: Where To Get Sample Pattern Explanation

Oct 9, 2010

i need MVC pattern with sample example....

View 1 Replies

Is Using An EntityDataSource In Keeping With The MVC Pattern

Apr 23, 2010

I'm utterly new to APS.NET and in particular the MVC model...! I have a Telerik RadGrid control that I'm using. Until now (following NerdDinner) I was having the Model passed back to the view and this provided access to the various properties I wanted.

eg: Inherits="System.Web.Mvc.ViewPage<MySqlMvc.Helpers.PaginatedList<MySqlMvc.Models.Customer>>

.. lets me loop around the Model object and extract Customer data. This RadGrid control, however, needs me to use an EntityDataSource (hooked up via the designer). Does this have implications for maintaing the MVC pattern? I'm a little confused about how the EntityDataSource works in relation to my Model.EDIT: I do know there is an MVC version of the RadGrid but we also need the RadScheduler and a few others.. besides that, I'd still like to know the impact.

View 1 Replies

MVC :: How Should Use The Service/repository Pattern

Dec 8, 2010

i'm new to asp.net MVC, and I'm trying to understand the service/repository pattern and how to best implement it.

I've followed the MVC Music store tutorial, and it suggests that the public partial class ShoppingCart implements an AddToCart method looking like this:

[Code]....

Now if I would like to use the service/repository pattern in a correct way, should I just replace the row "storeDB.AddToCarts(cartItem)" with something like cartService.AddToCarts(cartItem) and then just save the added row by calling cartService.Save() instead of shopDB.Save()? The methods AddToCart(...) and Save() in cartService then calls the repository that does the actual saving.

View 3 Replies

Which Design Pattern To Choose

Jul 20, 2010

I am using asp.net and c#.

I have a some classes. Some of the classes are having same methods insert, update and delete.

Each insert will insert different data to different table. (same for update and delete). What type of pattern can be applied for this kind of class.

View 3 Replies

Which Is The Best Pattern For Starting New Project In MVC

Jan 8, 2010

which is the best for starting up a new project in ASP.Net MVC? I have added this question as to know what are the different options.

View 4 Replies

What's The Best Logging Pattern For Mvc 2 Using Log4net

May 11, 2010

What is the best logging pattern for asp.net mvc 2 using log4net? When should I initialize logger how should I access logger instance?

View 1 Replies

C# - Session Vs Singleton Pattern?

May 12, 2010

I have a web application where I would like to pull user settings from a database and store them for Global access. Would it make more sense to store the data in a Singleton, or a Session object? What's the difference between the two?Is it better to store the data as an object reference or break it up into value type objects (ints and strings)?

View 3 Replies

Singleton-Pattern C# For Each User?

Sep 16, 2010

i'm building a web application with asp.net c# and i have a class that i want to use in multiple pages witouth instantiate it every time. I need to load the data in it and never lose them during the user session time. I thought about the singleton-pattern but it shared the instance of the class beetween browsers.

View 4 Replies

Architecture :: Use Objectdatasource With MVP Pattern In C#.net?

Mar 22, 2010

How can we use ObjectDatasource with MVP pattern in ASP.NET application?

In 3-tier architecture there is no Data Access layer,.in place of DAL, I want to consume Web Services and Request and Response is in the form of Custom objects i.e. BusinessRequest and BusinessResponse class type.

Is it possible to merge all these in one solution, MVP, 3-tier web application, No DAL, Only consuming Web Service , BAL, ObjectDataSource, GridView?

View 3 Replies

Use MVP Pattern And Add A Presenter Layer In Web App?

May 12, 2010

I would like to use MVP pattern and add a presenter layer in my web app. EX;- for filling the data in page I am doing like this.

[Code]....

If I add a presenter class, Do I need to move this code in presenter layer?

View 2 Replies







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