Showing posts with label example. Show all posts
Showing posts with label example. Show all posts

Monday, March 26, 2012

Performance with OO approach

At the moment, I use adhoc data access to load data. I am looking at moving away from this and using classes instead. Lets take an example - I am making a booking system for a doctor's surgery. At the moment, I would load the data for a single booking straight from the database. So I would create a SqlCommand, and use a stored procedure to retrieve the values I want.

I want to move this into a seperate class. This would make it a lot easier to manage. So I would have a class called clsBooking. Within this class I would have functions such as:

Struct Booking BookingID as integer PatientName as varchar'''' etc. etc.End StructFunction getBooking (BookingID) as BookingFunction getBookingForPatient (PatientID) as Booking()etc.etc.

What I want to know is how this will impact the performance of my website. I do not expect more that 5 concurrent users at one time, so I do not see a huge problem. I would still like to know what issues I may face though.

Thanks for any help

Jag

Hi,

for all my asp.net programs i have implemented a complete object oriented business layer. I have no problems with performance with this systems. But why you use a struct instead a class? I think you should implement a class like this:

class Booking
{
private int bookingID = 0;
... other variables...

public Booking(int id)
{
Create object and load data ...
}

public int BookingID
{
get
{
return bookingID;
}
}
... and so on ...
}

Regards
Marc André


I am new to this - so I will be learning as I go. So far I have used a struct because I was loading the information for the logged in user and saving this in the session. I did not want to load the user data every time the pages loaded, but I also needed something that was serialisable.

I also like it because the code looks cleaner (rather than having a lot of public variables, I have one struct I access and I know what information I can get for that booking).

This is a simplified example. I am actually designing this for a survey with tickboxes - and so I could anything above and beyond 50 fields I need to load into the class.

One problem I am not sure how to handle is a search datagrid. I have a filter with a lot of choices, and I build the sql query dynamically through code. I'm not sure how this fits into the OO approach.


Hi,

on MSDN exists a good Tutorial about OO and ASP.NET:http://msdn2.microsoft.com/en-us/library/bb332381.aspx

Regards
Marc André

'permanent' web site url while browsing?

Hi all!

Does anyone know of a way to keep a permanent url throughout a user's
browsing?

For example, if my web site's address is http://www.mysite.com,
I have noticed that some sites keep that url 'permanent' somehow,
i.e. doesn't change while e.g. clicking on a link!

How is this accomplished? Maybe some sort of script?

Thanks in advance!use a frame.

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available

"patrickdrd" <patrickdrd@.discussions.microsoft.comwrote in message
news:FDA51396-2304-4098-9A24-2AB478A8EF88@.microsoft.com...

Quote:

Originally Posted by

Hi all!
>
Does anyone know of a way to keep a permanent url throughout a user's
browsing?
>
For example, if my web site's address is http://www.mysite.com,
I have noticed that some sites keep that url 'permanent' somehow,
i.e. doesn't change while e.g. clicking on a link!
>
How is this accomplished? Maybe some sort of script?
>
Thanks in advance!


No, I don't like frames,
something else?
Hi,

patrickdrd wrote:

Quote:

Originally Posted by

No, I don't like frames,
something else?


Apart from frames of iframes, there are no alternatives using standard
HTML / JavaScript. Even when using URL rewriting, you still need to
provide a unique URL to the server.

Other solutions could be using WPF, Flash or any other type of plug-in.
In these cases, the navigation is not handled by the browser anymore,
but by the plug-in itself.

HTH,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering, Blog: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Even when using URL rewriting, you still need to

Quote:

Originally Posted by

provide a unique URL to the server.


I don't care about the server,
I care about what the client can see,
will the client realize the same url by that?
Hi,

patrickdrd wrote:

Quote:

Originally Posted by

Quote:

Originally Posted by

>Even when using URL rewriting, you still need to
>provide a unique URL to the server.


>
I don't care about the server,
I care about what the client can see,
will the client realize the same url by that?


Maybe you don't, but the web browser does care.

It's not possible, except by the solutions already provided to you.

Greetings,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering, Blog: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
no

use forms.

So if the user clicks the biteme button, the page shows the biteme stuff.
if the user clicks the bitemybubbles button the page shows the bitemybubbles
stuff

same url the whole time
this is usually done one of 2 way:

1) site frameset
2) model-view-controller pattern (site is just one page)

-- bruce (sqlwork.com)

patrickdrd wrote:

Quote:

Originally Posted by

Hi all!
>
Does anyone know of a way to keep a permanent url throughout a user's
browsing?
>
For example, if my web site's address is http://www.mysite.com,
I have noticed that some sites keep that url 'permanent' somehow,
i.e. doesn't change while e.g. clicking on a link!
>
How is this accomplished? Maybe some sort of script?
>
Thanks in advance!


What about Server.Transfer?

Keep transferring the user to another page. The server knows, the client
doesn't.

This is (kinda) similar to proper MVC, which .NET doesn't really do that
well, in that the context keeps getting forwared somewhere else to handle
the request and provide the view.

"Laurent Bugnion [MVP]" <galasoft-lb@.bluewin.chwrote in message
news:OQlXfg3WHHA.1180@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

Hi,
>
patrickdrd wrote:

Quote:

Originally Posted by

Quote:

Originally Posted by

>>Even when using URL rewriting, you still need to provide a unique URL to
>>the server.


>>
>I don't care about the server,
>I care about what the client can see,
>will the client realize the same url by that?


>
Maybe you don't, but the web browser does care.
>
It's not possible, except by the solutions already provided to you.
>
Greetings,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering, Blog: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch

'permanent' web site url while browsing?

Hi all!
Does anyone know of a way to keep a permanent url throughout a user's
browsing?
For example, if my web site's address is http://www.mysite.com,
I have noticed that some sites keep that url 'permanent' somehow,
i.e. doesn't change while e.g. clicking on a link!
How is this accomplished? Maybe some sort of script?
Thanks in advance!use a frame.
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
"patrickdrd" <patrickdrd@.discussions.microsoft.com> wrote in message
news:FDA51396-2304-4098-9A24-2AB478A8EF88@.microsoft.com...
> Hi all!
> Does anyone know of a way to keep a permanent url throughout a user's
> browsing?
> For example, if my web site's address is http://www.mysite.com,
> I have noticed that some sites keep that url 'permanent' somehow,
> i.e. doesn't change while e.g. clicking on a link!
> How is this accomplished? Maybe some sort of script?
> Thanks in advance!
No, I don't like frames,
something else?
Hi,
patrickdrd wrote:
> No, I don't like frames,
> something else?
Apart from frames of iframes, there are no alternatives using standard
HTML / JavaScript. Even when using URL rewriting, you still need to
provide a unique URL to the server.
Other solutions could be using WPF, Flash or any other type of plug-in.
In these cases, the navigation is not handled by the browser anymore,
but by the plug-in itself.
HTH,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering, Blog: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
> Even when using URL rewriting, you still need to
> provide a unique URL to the server.
I don't care about the server,
I care about what the client can see,
will the client realize the same url by that?
Hi,
patrickdrd wrote:
> I don't care about the server,
> I care about what the client can see,
> will the client realize the same url by that?
Maybe you don't, but the web browser does care.
It's not possible, except by the solutions already provided to you.
Greetings,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering, Blog: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
no
use forms.
So if the user clicks the biteme button, the page shows the biteme stuff.
if the user clicks the bitemybubbles button the page shows the bitemybubbles
stuff
same url the whole time
this is usually done one of 2 way:
1) site frameset
2) model-view-controller pattern (site is just one page)
-- bruce (sqlwork.com)
patrickdrd wrote:
> Hi all!
> Does anyone know of a way to keep a permanent url throughout a user's
> browsing?
> For example, if my web site's address is http://www.mysite.com,
> I have noticed that some sites keep that url 'permanent' somehow,
> i.e. doesn't change while e.g. clicking on a link!
> How is this accomplished? Maybe some sort of script?
> Thanks in advance!
What about Server.Transfer?
Keep transferring the user to another page. The server knows, the client
doesn't.
This is (kinda) similar to proper MVC, which .NET doesn't really do that
well, in that the context keeps getting forwared somewhere else to handle
the request and provide the view.
"Laurent Bugnion [MVP]" <galasoft-lb@.bluewin.ch> wrote in message
news:OQlXfg3WHHA.1180@.TK2MSFTNGP05.phx.gbl...
> Hi,
> patrickdrd wrote:
> Maybe you don't, but the web browser does care.
> It's not possible, except by the solutions already provided to you.
> Greetings,
> Laurent
> --
> Laurent Bugnion [MVP ASP.NET]
> Software engineering, Blog: http://www.galasoft-LB.ch
> PhotoAlbum: http://www.galasoft-LB.ch/pictures
> Support children in Calcutta: http://www.calcutta-espoir.ch

Wednesday, March 21, 2012

Perserving characters in Session object

Hi,

I am having a problem storing Irish text in a session object - Irish text
has some symbols ( for example) that are being lost when I retrieve the
text from the session.

Any ideas how I can deal with this - the characters are being displayed
correctly on the page itself if they come from the database or any other
source rather than the session object.

JoeAcutally after a bit of further investigation I discovered that by default
asp.net uses UTF-8 (unicode) for everything which would accommodate these
characters. What was happening in my case was that I was using the thycotic
remote scripting component to do some server updates and to send such
characters to the server requires that you urlencode them first as that
component seems to rely on a hidden frame in the page to call the remote
script.

"Joe Molloy" <molloy_joe@.hotmail.com> wrote in message
news:OcCcchFxFHA.2960@.tk2msftngp13.phx.gbl...
> Hi,
> I am having a problem storing Irish text in a session object - Irish text
> has some symbols ( for example) that are being lost when I retrieve the
> text from the session.
> Any ideas how I can deal with this - the characters are being displayed
> correctly on the page itself if they come from the database or any other
> source rather than the session object.
>
> Joe

Perserving characters in Session object

Hi,
I am having a problem storing Irish text in a session object - Irish text
has some symbols ( for example) that are being lost when I retrieve the
text from the session.
Any ideas how I can deal with this - the characters are being displayed
correctly on the page itself if they come from the database or any other
source rather than the session object.
JoeAcutally after a bit of further investigation I discovered that by default
asp.net uses UTF-8 (unicode) for everything which would accommodate these
characters. What was happening in my case was that I was using the thycotic
remote scripting component to do some server updates and to send such
characters to the server requires that you urlencode them first as that
component seems to rely on a hidden frame in the page to call the remote
script.
"Joe Molloy" <molloy_joe@.hotmail.com> wrote in message
news:OcCcchFxFHA.2960@.tk2msftngp13.phx.gbl...
> Hi,
> I am having a problem storing Irish text in a session object - Irish text
> has some symbols ( for example) that are being lost when I retrieve the
> text from the session.
> Any ideas how I can deal with this - the characters are being displayed
> correctly on the page itself if they come from the database or any other
> source rather than the session object.
>
> Joe
>

persist a class over a session - concept

hello,
i have a class, for example :"CustomerClass" , with a set of public
properies like CustNr,CustName,CustEmail ...
The class is initialised when the session is started.
What is the best way to persist the property values?
Must each property stored in a separate session, and by each access read the
valueof the session - or exist a better way...
thankshttp://spaces.msn.com/sholliday/ 10/24/2005
Check my Blog.
This is a wrapper... to store objects in a session, ... not just properties
of objects.
..
"Xavier" <Xavier@.discussions.microsoft.com> wrote in message
news:DA11396B-EC6B-44BD-BD1C-2ACE2EE491B0@.microsoft.com...
> hello,
> i have a class, for example :"CustomerClass" , with a set of public
> properies like CustNr,CustName,CustEmail ...
> The class is initialised when the session is started.
> What is the best way to persist the property values?
> Must each property stored in a separate session, and by each access read
the
> valueof the session - or exist a better way...
> thanks

persist a class over a session - concept

hello,

i have a class, for example :"CustomerClass" , with a set of public
properies like CustNr,CustName,CustEmail ...
The class is initialised when the session is started.

What is the best way to persist the property values?
Must each property stored in a separate session, and by each access read the
valueof the session - or exist a better way...

thankshttp://spaces.msn.com/sholliday/ 10/24/2005

Check my Blog.

This is a wrapper... to store objects in a session, ... not just properties
of objects.

...

"Xavier" <Xavier@.discussions.microsoft.com> wrote in message
news:DA11396B-EC6B-44BD-BD1C-2ACE2EE491B0@.microsoft.com...
> hello,
> i have a class, for example :"CustomerClass" , with a set of public
> properies like CustNr,CustName,CustEmail ...
> The class is initialised when the session is started.
> What is the best way to persist the property values?
> Must each property stored in a separate session, and by each access read
the
> valueof the session - or exist a better way...
> thanks