Architecture :: Handling Collections Related To An Object Not Yet Persisted

Nov 15, 2010

how do you treat situations where there is the need of storing collections of object belonging to an object not persisted on db (not yet). For example , suppose we have a web application for submitting orders. The user click on 'Create new order" , then insert order's data , choose items from a catalog and add them to the order. Finally he "submit" the order. I can see two different way to persiste data :

a) create on db an empty order instance when user click on "create new order" , so that the orderitems collection could be directly associated (saved) with that instance in the db.

b) keep all data in memory and finally save order and orderitem.

The b option imply storing (in session?) the orderitems collection till submit. Are there, probably, other solutions. Which are best practices in these situation?

View 4 Replies


Similar Messages:

Custom Server Controls :: Property Collections Not Persisted When Control Inside Update Panel And Content Placeholder

Apr 13, 2010

I'm creating an ASP.NET Control which has a property collection for Columns which the user can edit in the Property Collection Editor..

In most circumstances this works fine, the collection can be edited in the designer and the appropriate tags are added inside the control in the ASPX file.

It works fine when

My control is added to the form

[Code]....

My control is added inside an Update Panel

[Code]....

[Code]....

However, if My control is inside a Content Placeholder which is inside an Update Panel, it fails to work as it should. In this scenario, when the Columns collection is edited in the designer, if you then switch back to Source view, the Columns collection is emptied. I have to save the aspx page before switching back to Source view for the changes to be kept.

[Code]....

how to get around this problem? Is there something I may have missed?

Here's the code for the Control

[Code]....

View 2 Replies

Web Forms :: Error Handling For Object Reference Not Set To An Instance Of An Object?

Aug 17, 2010

This might have been asked before but I did a quick search and found nothing.

Problem: I want to get the name of the object that has a value of nothing and the type of the object when the "Object reference not set to an instance of an object error" occurs. The type obviously can be Object or specific. I want this information so that I can log a better error message in the error handling module. The only real useful information currently that comes back from the Exception object on a try catch is the line number at which the error occurred which in most cases is adequate except when you have functions calling functions, all in one line.

View 5 Replies

Architecture :: Text - Upload Images Related To Article

Dec 10, 2010

The user can write articles and upload images related to that article. Let's say that there is a form that collect the article text and, under it, there is a FileUpload control for images. Here, I have a question. What if the user has uploaded some images and then he closed the browser, before submitting, cancelling the operation? the images have been uploaded to the server wasting space!

one solution I've figured out is to store "ImageInfo"s in a list, and store the list in the Session object. And when the user submit the article, the images in the list should be marked as "related" and then inserted. and in the Session_End event I should delete every image does not have the "related" mark.

View 6 Replies

Architecture :: Getting All NewsCategories And Related NewsItems True The NewsCategorie Class?

Apr 19, 2010

I've been working my way true the OOP design patterns or Models in VB.NET with some simple databinding etc.

There is one thing that's not very clear to me, let me explain.

How would one merge objects or class objects to have a "one to many" or "many to many" relationship or other more complex databinding?

For example, lets say I have a class NEWS, in this class i have some properties like NewsID, NewTitle, NewMessage, ... and some functions like Function GetAllNews() As List(Of News). Now I have a Class NEWSCATEGORIES, with again some properties like NewsCatID, NewsCatTitle, .... and also a function GetNewsCategories() As List(Of NewsCategories).

How would I get All NewsCategories and related NewsItems true the NewsCategorie Class like for example GetNewsCategoriesJoinArticles() as List(Of ????). I know I can do this with a datareader and then in my webforms loop the datareader, but could this also be done in a typesafe manner?

View 3 Replies

ADO.NET :: Insert Into 3 Related Tables Using Three Tier Architecture And Typed Datasets

Aug 29, 2010

I am using ASP.NET (C# and sql server express 2005) for my web application project. I have three related tables. I want to do an insert using typed datasets,tableadapters and three tier architecture. I wish to know how to do simultaneous inserts in 3 tables. So i wish to insert a row in first table and get its primary key. Same with the second table. I will use the primary keys of those first two tables to do the insert in the third table. How can i accomplish this using formview control and what methods should i use??

View 3 Replies

Architecture :: Exception Handling In MVP?

May 28, 2010

I'm wondering what's the preferred way to manage exceptions in an MVP implemented with a Passive View.

There's a discussion in my company about putting try/catch blocks in the presenter or only in the view.

In my opinion the logical top level caller is the presenter (even if the actual one is the view).

Moreover I can test the presenter and not the view. This is the reason why I prefer to define a method in the view interface:

[Code]....

View 2 Replies

Architecture :: Best Practice For Handling Exception?

Jun 3, 2010

I devide my website on 3 layers :

DAL(Data Access) - simple extract data from DB using LINQ
BLL(Business Logic) -

cache data and in try/catch block call function from DAL and throw it to UI :
try
{
}
catch (Exception ex)
{
//Log error
throw ex
}

UI (User Interface) - simple working without handling any exception,

So if error occured in BLL i will be redirected to Error.aspx page with message that something wrong.

how and where handle exceptions, or may be exists common patter where handle and how to inform user about errors ? Can anybody share bes practice.

View 1 Replies

Architecture :: Handling Data From Two Tables?

Jul 17, 2010

I will try to explain my doubt and keep the code out, maybe for a second post. The greatest problem i am facing here is the logic :P.

At this point i have two tables: Empregado (Worker) and Cargo (Post). One post have many workers and one worker has only one post. In the database i think i am fine, a simple relationship one - many.

I've mapped the tables into classes with the same fields. As well i've created collections using generic lists. Each collection has a method that acess the bank and recover the data.

My worker class agregates one instance of post. I mainly use this to show the data i need. Basicaly i do a select, join the tables and fill the properties of the worker and the post.

The doubt: Is this a good pattern? Up to this moment i am not worried with blinding light performance, but in how to act in an good OOP pattern.

View 2 Replies

Architecture :: Design A Good Exception Handling?

Jun 4, 2010

I need to design a good exception handling. That can include logging and user friendly error page etc I read more articles and got some ideas. I am not using Enterprise Library now.

View 4 Replies

Architecture :: Exception Handling In Multi-tiered Applications?

Apr 27, 2010

Even though I'm trying to implement exception handling in a multi-tiered Windows application, catching and throwing exceptions should be the same for Windows and Web (sans global.asax and web.config custom errors).

I have a webform with a texbox that displays exceptions. So my webform invokes a method in BusinessTier class which then invokes a method in DataTier class. How can I throw my DataTier method exception so it reaches my webform?

View 2 Replies

Architecture :: Dynamic Exception Handling In Saas Application?

Dec 29, 2010

Dynamic Exception handling in Saas application

View 3 Replies

Architecture :: Looking For Better Way To Design, To Use Object's Properties With The Object Data Source?

May 10, 2010

I've posted the same question in the Object Data Source forum. This is a link to it http://forums.asp.net/t/1554083.aspx. Maybe I should've posted here to begin with. There seemed to be some overlap so I wasn't sure which was the best on to post the question in.

I'm trying to get a better understanding of how I could've designed my app so that the Object Data Source could work with the properties of my business objects. Please read the other post to see how it's currently being done. Sorry for the link to the other page. I didn't want to post a bunch of duplicate information. I would love to get some suggestions for alternative ways of doing this.

View 1 Replies

Architecture :: Design Patterns For Handling User Web Navigation And Flow?

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

Architecture :: Exception Handling Between Data Access Layer And Code Behind?

Jul 20, 2010

If an error happens in the DA_layer, how do I pass it do the code_bedhing to show the user?

[Code]....

View 3 Replies

Handling Timeouts In A Website SQLCommand Object And C#?

May 14, 2010

I'm using visual studio 2008 and sql server 2005 and everything is working just fine under normal use. However if a user is on a page for a while several minutes with no activity then clicks a button on occassion the site throws the following exception ...

Procedure or Function "sp_name" parameter '@SomeParameterName', which was not supplied

I'm also encountering this error in Visual Studio while debugging the application, in otherwords run the site from visual studio then make some change to the html in VS save the changes and refresh the page.

The error is not consistent nor is the time the page has to stay idle in order for it to occur....

The current sql command object timeout is 30 secs and the website timeout is 30 minutes.

View 1 Replies

MVC :: Handling Dependency Object Creation In One Form?

Feb 17, 2010

Let's take a trivial sample model:

[Code]....

View 2 Replies

Architecture :: Store ID Or Object In DTO Object?

Jun 15, 2010

I'm currently creating a Class Library for DTOs and was wondering if I should store an ID or an Object

For example:

ProductDTO (class)
ID (Int32)
Code (String)
Description (String)

[Code]....

View 1 Replies

DataSource Controls :: Unable To Cast Object Of Type '<TakeIterator>d__3a`1[System.Char]' To Type 'System.Collections.IList'

Jan 2, 2010

I want to do paging the API Membership without using the datacontrols, but I get this error "Unable to cast object of type '<TakeIterator>d__3a`1[System.Char]' to type 'System.Collections.IList'." when I do this,

[code]....

View 1 Replies

DataSource Controls :: Cannot Access A Disposed Object When Handling Foreign Key Relations?

May 15, 2010

i am currently working on an asp.net mvc 2 web app using LinqToSQL. I would like to handle a scenario where a user comes form a country and for this i have set the users - countries db relationship and in my user model i have a CountryId property.

I would like to display the country name on my users display view, so i tried fetching the country name like this: User.Country.Name, but an exception occurs that i cannot access a disposed object. I understand that this is caused by the way i handle my users repository and service.

This the repository users code:

[Code]....

This is the service users code (the repository is not class level property, but a local one that gets dipsosed immediately after calling it):

[Code]....

So, how could i handle such a scenario, where i would like the Country model to be also fetched in order to use it later? Should i convert the repository model a class level proprty in order not to get disposed?

View 3 Replies

Architecture :: Handling Asynchronous Server To Server Interface?

Mar 11, 2010

So this interface allows one server to request data from another server. The catch is that all xml for the interface is transmitted entirely over http posts followed by an empty status code 200 response. No data is sent in a response. So if my application wants to requests data, we send an http post with the xml request and receive a blank 200. Then, shortly after our request, we'll receive an http post to a predetermined URL with the xml data which we then send a blank 200. This data will then be stored in a SQL database. This interface cannot be altered.

The reason this is problematic is because our server is handling requests from clients that need that data in the response. If a user requests for data that isn't available in our database, it needs to be requested from the interface and then returned in the response. I'm just not sure how to get this to work out. I've thought about polling the database, but I'm worried about thread pool issues. I've also looked into using ManualResetEvent.WaitOne to halt the processing of the client request and then calling Set when the interface sends the data (as a request). I've read that wait threads are shared, but just don't know if this will scale well. Does anyone have any insight or I'm pretty much stumped on this one...

View 4 Replies

Active Index Is Not Being Persisted In JQuery Accordion Change Event?

Feb 1, 2010

I have an asp.net aspx page and on that page I have a hidden input field with and id of paneIndex. However, when I load the page, the alert shows index 1 which is correct on the first load, but if I open up pane 3 for example, the alert shows 1 still. Am I doing something wrong?

In a Custom.js file, I have the following code:

[code]....

View 1 Replies

State Management :: Viewstate Not Being Persisted Across Postbacks On Web User Control?

Mar 5, 2010

1) I found that my viewstate was not being persisted across postbacks for web user controls. I ensured that the Enable Viewstate property was set to true (of the page)

2) The Viewstate isnt being persisted on the 1st postback.

3) However, it is being persisted from the 2nd postback onwards.

I stepped through the code to ensure that the Viewstate had the 2 keys that I was adding on page load. However, on the 1st postback, the viewstate is empty. Everything is ok from the 2nd postback onwards.

[Code]....

View 3 Replies

Architecture :: Want To Make Public Object On ,net Page

Aug 27, 2010

in asp.net can i make public objects on my page, for example

public Customer cust1 = new customer();

and use this object on my entire code?

what are the drawbacks of creating public objects??

a single object will be created for all users??? or each user will have a different object?

View 2 Replies

Architecture :: Check For Nulls In An Object Aggregation?

Dec 30, 2010

I am working on a legacy application. It uses custom MVC framework and Windows Communication Framework service to bridge the Presentation layer with the rest of the application (i'll call this AppServer).

Every Entity in the AppServer inherits from BaseEntity which contains the method:

[Code]....

As you can see:

if the personObject was not null, but the ContactAddress was, [which is exactly what happens in the construction of a PersonObject in the event that no contact details are provided (hence they are not present in the HashTable and dont get created)] then the code will fail with a null reference exception.

SO:

Is there a fundamental flaw in the way that objects are getting created? It would be easy to point the finger in this direction, however, im sure there must have been some reason for the original architect to choose not to instantiate an empty ContactAddress object every time a Person object is referenced - EG if in a particular Presention->AppServer Request/Response cycle we only want a person's login details - we wouldn't care about the ContactDetails.

FINALLY MY QUESTION:

Is there a clean way to check for null objects within an aggregation, without doing something like:

if(Parent!=null)
if(Parent.child!= null)
if(Parent.child.child != null)

It just looks messy and it seems such a common problem, im sure there would be a better way of doing things.

View 5 Replies







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