Patterns To Use When Building Complex Web UI?
Jun 24, 2010
I need to implement a wizardy, dynamic UI that uses complex validation of the style:
If A = 1, show controls B, C, D. B is required, C is not, and D is not required must be less than 30 if it is populated.
If A = 2, show controls B, D, E. B is not required, D is required but has no limits, and E is not required.
If B is not null, show controls B, D, E. B is not required, D is required but has no limits, and E is not required.
Historically, I have made my presentation layer as "dumb" as possible in that it is only responsible for capturing user input and binding it to the appropriate domain model. The domain model, in turn, contains the logic needed to validate it's state and that of any child objects, and then communicates any invalid state to the presentation layer via notifications. As such, this requirement for a highly "intelligent" UI represents a departure for me.
I think I have no choice but to construct 2 very similar class hierarchies:
one that will capture presentation business rules (i.e. what fields are visible) and control what renders in the View
one that will capture domain business rules (when field A = X, then field B should be not null and in the range of n to m) to disallow objects with an invalid state from being persisted
Sill I have far more questions than answers on my strategy moving forward. Is there a set of design patterns I can draw on to build such a dynamic UI? I do have the option of using ASP.NET MVC or WebForms, so whichever approach will produce cleaner, testable code is preferred.
View 1 Replies
Similar Messages:
Jan 10, 2011
1.what is the difference between design patterns vs architectural patterns ?
2. In which situations They are preffered?
View 2 Replies
Feb 18, 2010
i created an intranet based website(information Portal)...i would like to know the pages each user visits and i want track there behavior...what tools should i include..
View 2 Replies
Apr 27, 2010
what are design patterns and UML diagrams with best examples. How we should use in real time scenarios. Recurring iam facing these type of questions in project round.
View 5 Replies
Jul 9, 2010
Does anybody knows good, short and slim tutorials (not here ), which describe actual/modern web-application architectures / patterns (especially for ASP.NET based (classic and MVC) applications (maybe also with embedded Silverlight components) ? How would you you design today an ASP.NET application which uses different datasources (databases, services,...) ? Background: I has been away a couple of years writing web applications, and I want to start now again. So at the moment I am a little bit unsure, how to take off and find the right starting point.
View 3 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
Dec 23, 2010
I will have the following possible strings:
12_3
or
12_3+14_1+16_3-400_2
The numbers could be different, but what I'm looking for are the X_X numeric patterns. However, I need to do a replace that will search for 2_3 and NOT return the 12_3 as a valid match.
The +/-'s are arthemtic symbols, and can be any valid value. They also ARENT required (in the example of the first) .. so, I might want to check a string that just has 12_3, and if I pass in 2_3, it would NOT return a match. Only if I passed in 12_3.
This is for a C# script.
View 2 Replies
Nov 20, 2010
I want a regular expression patterns to match for the following example.
USER@DOMAIN.COMDOMAIN\USERUSER
I need only the USER to be extracted from those.
View 2 Replies
Mar 9, 2011
I thought it should be a simple straight-forward matter but after struggling with it for too much time.
What I need is to redirect all requests for my web application that match the following pattern - "^(http://[^/]+/blogs/[^/.]+)/?$" to the path of "$1/Default.aspx".
(Using English rather than Regex: [URL]
The sub-directories in "blogs" do not physically exist, instead a 3rd party product deals with the requests to randomdir/Default.aspx", but when you go to "randomdir/" you get 404 not found, which is what I'm trying to fix.
I tried to use global.asax and also HttpHandler, but I couldn't get either of them to fire up on the requests to those 404 paths.
So, in short, what should I do to redirect paths of non-existing directories?
View 2 Replies
Feb 4, 2010
Let's say you're building something simple, like a data entry/CRUD form for working on an entity called Customer. Maybe you pass the CustomerID in via Session state.I tend to write a lot of fairly boilerplate plumbing code around handling that Session variable in a particular way. The goals vary slightly but tend to be things like:
Avoid cluttering the main flow of the page with plumbing code
Handle the back button intelligently
Remove the variable from Session and persist it to ViewState ASAP
Code defensively for failure situations where the state doesn't get passed, or is lost
Do you have a best practice for handling this situation? Do you have classes in your stack that handle this perfectly every time? Do you just call the Session variables directly? Do you use encrypted QueryString and avoid Session variables in this situation entirely in order to make the back button work a little better?Lately I've been using Properties with Session variables. Here's a simple example that I just threw together, although please keep in mind that this example would not be very tolerant of the back button:
Private ReadOnly Property CustomerID() As Integer
Get
If Me.ViewState(Constants.CustomerID) Is Nothing Then[code]....
View 1 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 26, 2010
I've been reading recently about EF4, and how to build an architecture for asp.net web forms application using it.
I explored using POCOs (self tracking entities), with WCF, but found out that my application will be deployed on a single box (i.e. one tier), so I started reading about logical separation of layers, and came up with the following solution:
DAL layer that contains EDMX model and EF APIs, and also generated context object.Entities DLL that holds all generated POCO entities using ADO.NET POCO entity generator. (for persistence ignorance, and decoupling entities from DAL).Business layer that contains a façade for each related group of business functions, the façade will be aware of and using DAL layer. And in each function, it will initiate context and uses different entities to carry out specific job (i.e. function).UI layer that only calls the business layer façade classes. With no awareness of DAL, but it will be aware of entities (i.e. using entities DLL), as the business layer will return results basically as entity collections.
I want to know what you think about this architecture.
I also read about an architecture that uses repository and unit of work patterns, but what I understand that context object is already implementing a UOF pattern, and also object sets are implementing repository pattern (correct me if I'm wrong), so the only advantage of using additional abstraction over them is to make the business layer communicates to my classes, not EF classes, and this is good only if the DAL strategy might change (i.e. by using another tool other than EF, which is not my plan).
View 8 Replies
May 31, 2010
I read some article about unitOfwork and repository but i'm still confused about how they interact, and how to use them in the right way.
I'm using an addressbook project to practise on patterns (even if , likely, patterns are not usefull) without any ORM framework for persistence.
My domain objects are (at now) : AddressBook (acts as an application controller), Contact (contains information about each contact in the address book), ContactGroup (mantain collections of contact).
Should i have to use distinct repository object for contact ad contactgroup?
I thought to use a UnitOfWork for the operation about the adding/removing contact to group : the user can add existing contact to a group, create a new contact while adding it to the group or remove contact from group.
View 1 Replies
May 17, 2010
I am having troubles understanding the purposes of using Factory pattern, I understand Factory pattern uses Factory class that has methods to return concrete objects. But why don't I simply use new opertor to create concrete objects? Some articles suggest Factory methods could return objects of different concreate classes, I can do the same thing by using switch statement.
Also are there classes in .Net framework already implementing Factory pattern? I think that will give me a better ideas why it is useful.
View 5 Replies
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
Jan 24, 2011
ive tried to build some base project with above technologies. I wanted maximum flexibility and testability so i tried to use patterns along the way to make this as a base for future projects. However, it seem.something is wrong or whatever and i really need help here. So
i have two questions :1- Is there anything wrong with my current code ? Ive applied patterns correctly ?
2- Why do this code actually connect to the database, create it, but doesnt support insert even if i perform the corrects operation ? (Look at the end of the post for details about this error)
I have two entities : Comment and Review
COMMENT [Code]....
REVIEW[Code].... I built up a base repository for each of them this way :GENERIC REPOSITORY[Code]...For specific operations, i use an interface :[Code]....So i am getting the generics operations from the abstract class plus the specific operations :[Code]....As you figured out, i also use a database factory will produce the database context :DATABASE FACTORY [Code]....DISPOSABLE (Some extensions methods...)[Code]....DATABASE [Code]....And to finish, i have my unit of work....UNIT OF WORK[Code]....I also binded using Ninject the interfaces :NINJECT CONTROLLER FACTORY [Code]....however, when i call in the constructor ...[Code]....
This seem to create the database but doesnt't insert anything in the database in EF4. It seem that i may figured out the problem.. while looking at the database object.. the connection state is closed and server version throw an exception of this kind :
ServerVersion = '(((System.Data.Entity.DbContext (_database)).Database.Connection).ServerVersion' threw an exception of type 'System.InvalidOperationException'
I am doing the right things ? Is there anything wrong in what ive built ? Also if you have recommandation about the code i posted, i would be glad. I am just trying to the learn the right way for building any kind of application in MVC 3. I want a good a start.
I use :
- Entity Framework 4 Code-First CTP 5
- ASP.NET MVC 3
- Ninject as DI Container
View 4 Replies
Mar 15, 2011
We have an existing, proprietary data processing application that runs on one of our servers and we wish to expose it as a web service for our clients to submit jobs remotely. In essence, the system takes a set of configuration parameters and one or more data files (the number of files depends on the particular configuration template, but the normal config is 2 files). The application then takes the input files, processes them, and outputs a single result data file (all files are delimited text / CSV or tab).
We want to now expose this process as a service. Based on our current setup and existing platforms, we are fairly confident that we want to go with WCF 4.0 as the framework and likely REST for the service format, though a SOAP implementation may be required at some point.
Although I am doing a lot of reading on SOA, WCF and REST, I am interested in other thoughts on how to model this service. In particular, the one-to-many relationship of job to required files for input. It seems pretty trivial to model a "job" in REST with the standard CRUD commands. However, the predefined "job type" parameter defines the number of files that must be included. A job type of "A" might call for two input files, while "B" requires 3 before the job can run.
Given that, what is best way to model the job? Do I include the multiple files in the initial creation of the job? Do I create a job and then have an "addFile" method where by I can then upload the necessary number of files?
The jobs will then have to run asynchronously because they can take time. Once complete, is it best to then just have a status field in the job object and require the client to regularly query the system for job status, or perhaps have the client provide a URL to "ping" when the job is complete?
View 1 Replies
Aug 9, 2010
Are there any patterns or practices for monitoring log4net exception logs across a cluster of web servers. I have considered several options including the following:
A central database
A log file retrieval system
A service based loggin architecture
View 2 Replies
Jan 20, 2011
Our site is expected to allow the user to do whatever they want from a number of different places. Except, that doing whatever they want really means firing off mini sequences of pages they must vist (or possibly abort from to go off to another task) before returning to their starting point. So, at any given time, the user has a list of pages they are allowed to go to, a list of pages they must go to in order to complete their task, and some end point they must eventually return to, all of which are constantly changing.
As an example, a user may choose to edit an order they placed, at which point they must step through a series of pages to edit the order. These pages to edit an order may be different based on the type of order they are editing, and they must return to whatever place they were at when they decided to start editing the order. They may also have certain options of other pages to visit during their order editing process.
I really need a good way to handle this for a large number of different scenarios, and allow it to be easily changed. Right now we are doing things like setting session variables when a user chooses an action and checking them within the page on button handlers to see what they are allowed to do or where they are allowed to go. I'd love to be able to abstract this out into something that can be easily examined in one place, or even data driven, and have some sort of navigation controller pointing them to the pages they can or must go.
View 6 Replies
Jan 7, 2011
I need to create a singleton that would hold lots of data for a spedesign patterns - Singleton behavior with multi-user requests in ASP.NETcific user. However, I am not unclear as to what the behavior of that singleton is in regard to multi-user app requests.
Here is the scenario:
On AppStart event I want to load common data for all users (from SQL) and store it as a collection somewhere within the ASP.NET storage mechanisms.
If I store that data in the cache, I would also have to create a static property in the Global.asax that would provide access to that the data from the cache.
This is not ideal because whenever an instance of any particular page, or generic handler, or what have you tries to query this data using Linq the property has to load the data from the cache... introducing latency. I need this data to be immediately available. (think of it as about 5K rows of data stored in collection of objects...)
I was thinking to use a singleton to get that data, and store it but I don't know how it would behave between requests (and postbacks), as well as application instances, in terms of its persistence.
On PostAuthenticate event I want to get user specific data from SQL in the form of a collection. If i store it as a singleton (in a similar manner as the common data) i am not clear as to:
How is the data persisted? What is the scope of that singleton (it should be for the duration of the user session). How can I ensure that the data is immediately available to whatever needs to consume it?
What happens between post-backs to that singleton? If another user logs in would another instance of that singleton be created for that specific application instance?
View 1 Replies
Mar 12, 2011
I understand the basics of setting up routes, I am trying to get a handle on how to organize more complex routes. Does the Route name do anything? I havn't seen a place it's actually used. If I have the route: controller/action/id/paramA/paramB/paramC. ParamA-C could be defining multiple parameters so First/Last/Zip or Phone/Zip/Birthday. Is it common practice to name the additional parameters with a generic name like paramA vs trying to differentiate a separate route for each?
Lastly, if you have multiple sites/functional areas in 1 site, lets say the asp.net site, each area MVC, Ajax, Forums ect were all different functional areas. Is it best to create a different group of routes such as hard coding the controller like:
MVC/action/id
Ajax/action/id
Forums/action/id
or is there a better way? What I am running into is 1 piece of the site overriding the other route because of the number/type of parameters.
View 5 Replies
Sep 18, 2010
I need to estimate (and probably build later on) complex filter in ASP.NET WebForms application. The filter has to be mostly based on ASP.NET AJAX or jQuery for high interactivity. The filter has to allow filtering data with complex logical conditions (and, or, braces) and several operators. A user has to be able to save the filter's query and use it (load it) later on (server logic). Moreover there is still discussion about in operator.
Application should provide some graphical filter builder. I want to have full control on set of operands (filtering fields) and operators. The component will be used for all filtering actions in application. My problem is only how to do the UI part - translation of builded "query structure" is not a problem.
Have you ever did something like that? Can you share some experience how to best and fastest build such component? Do I need to develop component or is there any existing one which has at least some of the functionality and can be extended to provide other functionality? Because I'm not very experienced with client side development, I don't know how complex task is developing such component from scratch.
Another possiblity is to define some meta query language and allow users to write the query to some query text box with support for building logical expressions. I have already checked available controls in DevExpress and Telerik toolkits:
DevExpress:
Pros: Really nice visualization, fast. We probably have DevExpress licences. Cons: Tightly coupled with DevExpress grid. Based on documentation no extensibility and no control over operands and operators. It uses operands provided as columns for grid - I need much more. Probably not possible to save and load filters.
Telerik:
Pros: Not coupled with grid, it looks like separate control. Cons: I didn't find documentation - I'm not sure about extensibility but the code looks like it uses some databind control as source of operands = problem. I don't like the visualization. Demo is really slow. We don't have Telerik licences.
View 3 Replies
Feb 10, 2011
How can I create a form that creates or updates a complex type that takes a form like:[Code]....
I would like to either create two forms one for tblstudent and one for tbldata and tblStudata or create one form for all three and give the illusion of multiple pages. I came across an old Railscast that talks about virtual attributes and a helper called fields_for which helps you switch between model contexts in a single form. Is there a way of achieving this kind of functionality with C# MVC 2 or 3?
If this sort of thing is not possible how else might I be able to handle create/update scenarios without defining two actions amd voews for each table entity I need to work with or god forbid separate controllers?
View 2 Replies
Jul 17, 2010
I really don't know if this Post fit in this Forum section. But here I go. I need some sugestion to develop an ASP.NET code that generate complex IDs / Keys automatically. Let me be more understandable:
I want to create uniquelly IDs with more complex composition (kind of 18958351512783997769711... or crlu0xakecjzlgmjsgnedr55) or something link that (doesn't matter the lenght... those are only examples).
So, I can use that to set COOKIE ID's... PRODUCTS CODE ID's.... CUSTOMER's CART ID's... etc... But it need to generate uniquelly numbers. I don't know if you got my point I hope you did.
View 3 Replies
Jan 20, 2010
I'm currently implementing a project using asp.net, c# and the MVP (Model-View-Presenter) pattern. The main purpose of this solution is to deliver a graph to the consumer, to be used by a variety of systems. It is basically a custom graph server.
The view page in this particular case has an MSChart control on it, which has to be dynamically populated and configured based on parameters in the QueryString. This can be as diverse as totally different types of data sets, display modes and so on, using a lot of the properties of the chart control.
Many of these properties are again of types which are particular to the chart control and would require the same dependencies as the chart control itself if they are to be set by the presenter.
I'm trying to figure out the best way to expose the properties to the presenter so it can work its magic.
Should I:
Just expose the whole chart object and live with a system.web type dependency in the presenter project? Make accessor and translation properties for all of the chart control properties so that I don't have the dependency, but add lots of complexity? Other, that I haven't thought of?
To me it seems that it would be against the MVP pattern to bubble a display control up into the presenter, but it seems that trying to map all the properties to DTOs or similar would be a lot of work that would add a lot of complexity, and while the solution would be somewhat more loosely coupled, I'm not sure the gain would be worth it in this case. How would you implement something like this, given MVP?
View 2 Replies