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
Similar Messages:
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
Mar 8, 2010
Except session and viewstate or a control with a value (including sqldatasource).Is there a way to store the value(s) in an object that will not loose the value if the page refresh?And also the best practice to hold sensitive value? I'm using viewstate with encryption for now but if p.e., have to hold a dataset then the page size will rise dramatically.
View 23 Replies
Mar 2, 2011
Does the DateTime object stores the CultureInfo with it, or you need to use the Formatter to format the DateTime according to current culture ?
I have a class property that retuns a DateTime. Within that property I am setting the DateTime object with current culture information using CultureInfo object. Below is the code for class property I am using:
public DateTime PrintedQuoteDate {
get{
DateTime printQuoteDate = DateTime.Today;
// cInfo = CultureInfo object
return Convert.ToDateTime(printQuoteDate , cInfo);
}
}
So my question is when I will use the above property in my code, will it have the corrosponding culture information that I am setting in its get method, or I will have to use the same CONVERT code for formatting date time. The restriction here is that the Property should return only DateTime type.
View 2 Replies
Apr 8, 2010
I'm not using the microsoft MembershipProvider system. I'm open to using bits and pieces of it.
In Web Forms I stored a lightweight User object in the Session Variable.
[Code]....
Then whenever I needed the full force of a user object I would ask my repository to return me the User object that matched (be it from the database or cache).
Where do I store my LightWeightUser object for the session's user in MVC, I see I still have access to Session, but is there a better place?
View 2 Replies
Apr 10, 2010
I'm using session to store C# object but my session is expiring regularly.
I've given 540 minutes for session timeout. ( <sessionState mode="InProc" timeout="540"/>)
Now I want to use cookie instead of session to remove this timeout problem.
code below:
[code].....
View 17 Replies
Aug 6, 2010
Why to Serialize an object to store in ViewState?
View 1 Replies
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
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
Oct 4, 2010
I am creating an authentication service. This service has one of the methods to validate username and password and return a status based on it.
The validation method has bunch of things to check before it can say user is valid. This method has a pseudo code similar to this:
If UserName and Password is correct
If User Account is Locked (due to invalid attempts)
{[code]....
As you can see there are lots of if else statements that I am writing. It looks more like a procedural programming rather than object oriented.How can I fit such kind of code in object oriented pattern?
View 2 Replies
May 29, 2010
I do not know how to create a business object for inserting data into the database.
View 2 Replies
Apr 26, 2010
I have a object of Class named "Employee" I need to store the object in the session. what happens if i do not serialize the object and store in the session.
View 7 Replies
Sep 8, 2010
I've build a class like this:
[code]....
The values of this class are set at postback by clicking a radiobutton list. Problem however is I don't know how to save this values across multiple postbacks. I thought of using viewstate but I'm not quite sure how to do it with this class.
Maybe I'm missing some important thing here.
Hope someone can point me in the right direction.
View 4 Replies
Feb 6, 2011
I been working on a simple site today and when I found myself surprised about this. I got a object model that gone have like a lot of emails to it so I thought Ill do a string array to keep them, then I paused and tried to figure how do I save that to a database and how do I work with this? I always found myself working with collections of objects instead. So I'm kinda embaries to say this but how do I work with this? can I save a array to database
[Code]....
View 3 Replies
Sep 21, 2010
Imagine I have a class MyTestClass. And I need an instance of this Type throughout my whole web application.Now there are several possibilities to accomplish this.1. Make MyTestClass static, make it contain static methods only
Probably the most performant solution. I'm not feeling lucky about using static fields though. Thread safety? What if my static class contained a static System.Collections.Queue?
View 8 Replies
Aug 4, 2010
Analysis and design C# application with pure object orineted feature .
for example
I get all the requirement for the user, How to analysis the system , keeping future changes in mind , design and system with pure object oriented feature .
in Short : design system with pure object oriented feature so that it flexible so that in future new version can be launch easily
View 1 Replies
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
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
Jan 13, 2010
I'm trying to better understand the life cycle of an object in the .Net framework. My companies Intranet has some custom classes that were written by a vendor that I'm trying to make some modifications to. Specifically I want to set some variables & hashtables to null when use of the object is done. For now I have this in the dispose event.
Is there any info you can point to that would be good reading on the life cycle of an object in the .Net framework? I.e. what order do the events fire in? OnInit, Initialize, finalize Dispose, etc. I have the ASP.net page lifecycle but I'm not looking for that.
View 3 Replies
Feb 6, 2011
My code is:
[code]....
When I run the program, an error occurs:
Unable to cast object of type 'System.Collections.Generic.List`1[System.Int32]' to type System.Int32[]'.
Why does this error occur?
View 2 Replies
Jan 12, 2010
I am creating a web service that returns the list of states. How do I create an object in C# in the web service that will return multiple values (of properties of an object). Currently, the way I am doing it, it only returns the last value pulled from the database. Do I need store an array of properties?
[code]....
View 5 Replies
Dec 30, 2010
I want to store object data to treeview node dynamically(while application running) , In windows form i use node.tag = ? , and it it ok , i try node.DataItem = something , but it is readonly , so how would i store object data in asp.net
View 3 Replies
Aug 24, 2010
I have been using properties and have idea that using properties with private fields we can implement validations and buisness rules in them.
But I am just thinking asp.net client side validation controls provide good strength and they provide good user experience as well. They can be used for any type of validation (using regular expression) on client side and their re-use is possible on server side. When validation controls are a must and they are powerful; is making properties not just wastage of time ?
Is there still some use of properties ?
View 6 Replies
May 27, 2010
If I'm returning an object, then it's pretty straight-forward. However, if I'm just trying to return whether or not the method was successful or not, what's the best option? Sure ... bool seems obvious - but what if you need to debug or get some additional details out of the method than just "yes/no"? Well that's where a string becomes more obvious, right? You can leave it empty to say that the method was successful or chock it full of details in the case of an error. But this can make it less intuitive to others who may have to run your functions and it also jumbles up everything you wanted to pass back into one large string.
View 3 Replies
May 6, 2010
I want to pass the Array ( object[]) or Structure data type value to the store procedure through
ibatis .net. I can do same by commandtext using SQLDBType.Structure. I am using Table value function in sql server 2008 and .Net 2010.
[URL]
View 2 Replies