StrataFrame Forum

Best Practise for the Web and Strataframe

http://forum.strataframe.net/Topic31914.aspx

By Olivier - 3/13/2013

Hi All,

I create some app on the web with c# (asp.net) and strataframe.

I have a lot of user which start a webform to add a new record,
when i click on new , i make : "this.MyBo.add()"

They make other things, during more 20min,  and the get a error when they validate their form.

I know , that i get grow up the session, but it's not recommandate on the web.

Why Strata store in variable Session ? not in the viewstate Session ?

Have you a solution for this problem ?

Thanks
Olivier
By StrataFrame Team - 3/15/2013

We use the Session because the business objects can get pretty large, and we didn't want to run into the maximum HTTP request size limit.  However, the business objects are serializable, so they can certainly be stored in the ViewState.  

To do this, build your own BasePage and don't use the StrataFrame one.  Create it by copying the one from the StrataFrame source code.  It's only ~300 lines of code, and everything will stay the same except for the InitializeBusinessObjects() method.  There are 2 references in there to the Session, and you can change those to ViewState.  That method is not overridable, otherwise, you could just override it rather than having to re-create the BasePage class.  Which is certainly another option: modify the source to make the InitializeBusinessObjects() method Protected Override and override it to store the BOs in the ViewState rather than the Session.

I'm thinking this is an implicit enhancement request to be able to store the v2 entities in the ViewState, no?
By Olivier - 3/15/2013

Hello Ben,

May be, i explain myself very bad.

I don't know if we store Strata on Session or Viewstate it's better.

But , i don't want to depend the limited time , for my user.

I mean, i want to understand how Entity framework work with asp.net
and if my problem will be resolv with Strata 2.0.

Does Entity depend some variable session ?

If the user add new record and my app can load their session with cookie,
to during more 24 h if i want.

If the user add new record with entity it's work without session or not ?

Strata will be fusion with entities ?

It's possible if the session is expired do not lose the value in textbox , to reload Bo to make an Add() ?

thanks for your help, i have many question about stroke with strata and the web .

ben
By Olivier - 3/15/2013

Hello Ben,

It's possible to desactivate the Object Session with Strata , to Load on each demand ?

Without modify the source code?

thanks
Olivier
By Michel Levy - 3/18/2013

Hi Ben,

I'll translate your answer on the French speaking SF forum, and I'll come back here if we need more help.
By StrataFrame Team - 3/18/2013

Thanks, Michel.  I was thinking about the problem over the weekend.  To store the business objects in the ViewState, you would need to modify the source code or copy out the source code and create your own BasePage class that works similar to the SF one.  If he wants to store the variables in the session, he could increase the session timeout and move the session state storage to SQL Server to preserve resources on the server.
By Olivier - 3/20/2013

Ben Chase (3/15/2013)


I'm thinking this is an implicit enhancement request to be able to store the v2 entities in the ViewState, no?


Hi,

I make a mistake about viewstate it's too heavy way.  If it's possible to desactivate the variable session
to get a load on each request. (it's the same for entity , how they do ? )

ps : i send to michel this website info.


http://forums.asp.net/t/1579957.aspx/1

http://www.mindscapehq.com/blog/index.php/2008/05/12/using-the-unit-of-work-per-request-pattern-in-aspnet-mvc/


thanks
Olivier,
By Olivier - 7/4/2013

Hello Ben,

In the version 2.0 , the Bo inherit from Entity ? it's exact ?

Do you know how entity store the Business object during the session ?
By Olivier - 7/4/2013

Hello

I get a idea about the solution.

It's possible like foxpro and cursor temp to store in Xml (dir temp for each session) or Sql Server,
the state of Bo Stratra. We can set up timeout on parameters Bo, if the temps are too old strat delete this.

It's a real problem, i understand we have plus to save the state session against entity or other bo.

But we need to understand , it's not the best way to work in the app web, only in winform. Please accept my enhancement
to have no problem with my user.

I know we can save on sql server session, but i use the classic session in proc , the problem is only for stratra

http://msdn.microsoft.com/en-us/library/ms178586.aspx

Do you know a simple way to save a Bo in xml file ?

Can you read the third post here ?
http://stackoverflow.com/questions/1725925/how-to-set-session-timeout-more-than-20-min

thanks
Olivier,
By Olivier - 7/4/2013

Hello

i forget to tell, i have test to use viewstate to save a session bo, but asp.net
say "Out Of Memory"

Thanks
Olivier,
By StrataFrame Team - 7/8/2013

There is already a way to save the BOs to XML.  You can use bo.CurrentDataTable.WriteXml(filename) to save the file and bo.CurrentDataTable.ReadXml(filename) to read it back in.  The only sticky point you may have to work with is determining the folder for your user.  You could create a folder with a GUID for it's name and store the path in a SQL table with the username and the time when the session was created.  When the user loads a page, check SQL to see if there is an existing session for them and then load the XML file from disk.  For that matter, you could also store the raw XML in a VARCHAR(MAX) field in SQL.  Then you only have to do one lookup.  Take the raw XML string, put it into an XmlReader and call bo.CurrentDataTable.ReadXml(reader).
By Olivier - 7/8/2013

Hello Ben,

Thanks for this approach ! it can help a little for the starting.

I have a question , if my app has 40 min time session.

My user start to fill the textbox , in new record, so i put StateAdding on strataframe,

if my user left his computer to go outdoor to see a customer, or take a call,
when he restart his input , the session are ended.

He push validate button, and he lose his customer form.

Can i save the state of bo with the fill textbox when he click on the validate button ?

How can save the state ?

i think, if i load editing state or adding state only on push validate button, i lose my binding field.

I don't know if you can see what i mean, with my poor english.

thanks for your help
i appreciate that.

Olivier
By StrataFrame Team - 7/8/2013

You can probably set the AutoPostBack="True" on each of your textboxes that collects data.  This will cause the form to post back to the web server each time one of the text boxes loses control.  That way, the user would only lose the last text box they were typing in when their session times out.  Each time the user tabs to a new textbox, the postback will copy the value back into the business object.  There's definitely a way to do it, we just need to find the right combination of properties on the UI controls.
By Olivier - 7/8/2013

Hello ben,


You don't need to do postback on each textbox, cause it's heavy way for the server process.
(i have 600 users , and 30 variable session (bo ) by user)
On the web app, we must save the transfer between server and client, it's for the reason, that ajax was create.

Strataframe is made for the winform concept, i try to find a way to work in the web form.
I'm sorry to see that no other develop web who saw this problem. May be they made only website not web app,
or more developer for the winform. i don't know.

The session variable is not the solution to save the state cause they are not permanent because of the number
of resource user
, and the other bo like entity or hibernate, not refresh the binding field when i postback on the server
 with expired session.

is It possible to desactivate the binding field refresh during an Editing or Adding state ?

If we found a solution, we have the best Bo all over the world, cause the other on the web work there are a web approach not fox approach !

thanks again for your help
Olivier